const echarts = require('echarts/lib/echarts');
import 'echarts/lib/chart/pie';
import 'echarts/lib/chart/line';
import 'echarts/lib/chart/bar';
import 'echarts/lib/chart/lines';
import 'echarts/lib/component/toolbox';
import 'echarts/lib/component/tooltip';
import 'echarts/lib/component/legend';
import 'echarts/lib/component/markPoint';
import 'echarts/lib/component/markLine';
import 'echarts/lib/component/title';
let exanded = false;
// var exandedFlag = -1;
// let q1=0;
// let d1 =0;
BlazeComponent.extendComponent({
  onCreated() {
    this.startTime = new Date(
      new Date().getTime() - new Date().getDay() * 24 * 60 * 60 * 1000,
    );
    this.endTime = new Date(
      new Date().getTime() + (7 - new Date().getDay()) * 24 * 60 * 60 * 1000,
    ); //this.unCompletedCards = []; //this.completedCards = [];
    //未完成任务和已完成任务集合
    //this.mergedCardsArr = [];
    //this.weekArr = ['人员', '被指派人', '标题', '标签', '创建时间', '耗时'];
    this.pageSize = 50;

    //扇形区域点击标记indexLabel
    this.indexTitle = '';
    this.indexLabelName = '';
    this.indexLabelColor = '';

    //pieChart兼容性视图
    this.pieChart = null;
    this.barChart = null;

    this.pieLoaded = false;
    this.seriesData = []; //pie图数据
    this.seriesUserData = []; //bar图数据

    //标签统计相关
    this.cardList = [];
    this.lableArr = [];

    //人员
    this.members = [];
    this.memberTasks = [];
    //成员
    this.membersNew = [];
    this.memberTasksNew = [];
    this.listsTitleArr = [];
    this.listsIdArr = [];
    this.dataArray = [];
    this.dataArr = new ReactiveVar([]);
    this.pageNo = 1;
    this.data1 = {};
    // console.log('------this.members---------', this.members);
    const currentBoard = Boards.findOne(Session.get('currentBoard'));
    const boardId = Session.get('currentBoard');
    Cards.find({
      boardId,
    }).forEach(card => {
      this.cardList.push(card);
    });
    //查询所有被指派人列表
    for (let i = 0; i < this.cardList.length; i++) {
      const assignees = this.cardList[i].assignees;
      assignees.forEach(assignee => {
        Users.find().forEach(user => {
          if (assignee === user._id) {
            this.members.push(user);
            this.memberTasks.push({
              userId: user._id,
              userName: user.username,
              // userName: user.profile.fullname,
            });
          }
        });
      });
    }
    //去重
    const obj = {};
    this.members = this.members.reduce(function(item, next) {
      obj[next._id] ? '' : (obj[next._id] = true && item.push(next));
      return item;
    }, []);
    const obj1 = {};
    this.memberTasks = this.memberTasks.reduce(function(item, next) {
      obj1[next.userId] ? '' : (obj1[next.userId] = true && item.push(next));
      return item;
    }, []);
    // console.log("-------------this.members,this.memberTasks----00000-------------",this.members,this.memberTasks);
    //查询所有成员列表
    for (let i = 0; i < this.cardList.length; i++) {
      const assignees = this.cardList[i].members;
      assignees.forEach(assignee => {
        Users.find().forEach(user => {
          if (assignee === user._id) {
            this.membersNew.push(user);
            this.memberTasksNew.push({
              userId: user._id,
              userName: user.username, // userName: user.profile.fullname,
            });
          }
        });
      });
    } //去重
    const objNew = {};
    this.membersNew = this.membersNew.reduce(function(item, next) {
      objNew[next._id] ? '' : (objNew[next._id] = true && item.push(next));
      return item;
    }, []);
    const obj1New = {};
    this.memberTasksNew = this.memberTasksNew.reduce(function(item, next) {
      obj1New[next.userId]
        ? ''
        : (obj1New[next.userId] = true && item.push(next));
      return item;
    }, []);
    //加上“无被指派人”
    this.members.push({
      _id: 'noAssigneeId',
      username: '无被指派人',
      // userName: user.profile.fullname,
    });
    this.memberTasks.push({
      userId: 'noAssigneeId',
      userName: '无被指派人',
      // userName: user.profile.fullname,
    });
    // console.log(
    //   '-------------this.members,this.memberTasks-----------------',
    //   this.members,
    //   this.memberTasks,
    // );

    // currentBoard.members.forEach((item, index) => {
    //   Users.find().forEach(user => {
    //     if (item.userId === user._id) {
    //       this.members.push(user);
    //       this.memberTasks.push({
    //         userId: user._id,
    //         userName: user.username,
    //         // userName: user.profile.fullname,
    //       });
    //     }

    //   });
    // });
    this.lableArr = currentBoard.labels;
    //  const boardId = Session.get('currentBoard');
    this.getAssigneesList(boardId);
    //---------设置【人员任务统计】“总计列”-----------by wangyu-----
    this.memberTasks.forEach((item, index) => {
      let indexmemberTasksCount = 0;
      this.listsTitleArr.forEach((item1, index1) => {
        indexmemberTasksCount += item[item1];
      });
      item['总计'] = indexmemberTasksCount;
    });
    this.listsTitleArr.push('总计');

    // console.log("-------------this.members,this.memberTasks-----------------",this.members,this.memberTasks);

    // Cards.find({
    //   boardId
    // }).forEach(card => {
    //   this.cardList.push(card);
    // });

    // for (let i = 0; i < this.lableArr.length; i++) {
    //   let indexLabelCardCount = 0
    //   const label = this.lableArr[i];
    //   for (let j = 0; j < this.cardList.length; j++) {
    //     const card = this.cardList[j];
    //     const cardLabelIdArr = card.labelIds;
    //     for (let k = 0; k < cardLabelIdArr.length; k++) {
    //       const indexLabel = cardLabelIdArr[k];
    //       if (indexLabel === label._id) {
    //         indexLabelCardCount++;
    //       }
    //     }
    //   }
    //   this.seriesData.push({
    //     value: indexLabelCardCount,
    //     name: label.name,
    //     itemStyle: {
    //       normal: {
    //         color: label.color
    //       }
    //     }
    //   });
    // }
    // console.log('----cardList-----', this.cardList);
    //  currentBoard.archive();
    // console.log('----currentBoard-cardList--', currentBoard);
    //---------结束----------
    this.indexTab = new ReactiveVar(1);
    this.thArrFlag = new ReactiveVar([]);
    this.aa = [];
    const aa = this.memberTasks;
    this.aa = JSON.parse(JSON.stringify(aa));
    this.aaNew = [];
    const aaNew = this.memberTasksNew;
    this.aaNew = JSON.parse(JSON.stringify(aaNew));
    const cc = [];

    const oo = [];
    const dd = [];
    // let bb = ["被指派人"];
    // let bb1 = ["被指派人"];
    const bb = ['被指派人'];
    const bb1 = ['被指派人'];

    for (let i = 0; i < this.listsTitleArr.length; i++) {
      cc.push({
        flag: 0,
      });
      oo.push({
        popTitle: this.listsTitleArr[i],
        checked: true,
      });
      //过滤掉总计
      if (i !== this.listsTitleArr.length - 1) {
        dd.push({
          popTitle: this.listsTitleArr[i],
          popId: this.listsIdArr[i],
          checked: true,
        });
      }

      bb.push(this.listsTitleArr[i]);
      bb1.push(this.listsTitleArr[i]);
    }
    // console.log('----cc---oo---bb---', cc, oo, bb)
    this.thArrFlag.set(cc);
    this.showSetColumnView = new ReactiveVar(false);
    this.showSetStaffView = new ReactiveVar(false);

    this.popMenuToggleArrV = new ReactiveVar([]);
    this.popMenuToggleArrV.set(oo);
    //-------------标签统计  设置统计列------------------
    this.popMenuToggleArrV1 = new ReactiveVar([]);
    this.popMenuToggleArrV1.set(dd);
    //-------------周报统计  设置统计人员------------------
    this.popMenuToggleArrV2 = new ReactiveVar([]);
    this.popMenuToggleArrV2.set(dd);

    oo1 = [];
    oo2 = [];
    oo3 = [];
    for (let i = 0; i < aa.length; i++) {
      const element = aa[i];
      oo1.push({
        popTitle: element.userName,
        //  "popTitle": user.profile.fullname,
        checked: true,
      });
      oo2.push({
        popTitle: element.userName,
        //  "popTitle": user.profile.fullname,
        popId: element.userId,
        checked: true,
      });
    }
    //-------------人员统计  设置统计人员------------------
    this.popMenu1ToggleArrV = new ReactiveVar([]);
    this.popMenu1ToggleArrV.set(oo1);
    //-------------标签统计  设置统计人员------------------
    this.popMenu1ToggleArrV1 = new ReactiveVar([]);
    this.popMenu1ToggleArrV1.set(oo2);
    //-------------周报统计  设置统计人员------------------
    this.popMenu1ToggleArrV2 = new ReactiveVar([]);
    this.popMenu1ToggleArrV2.set(oo2);

    this.indexBoardUserArr = new ReactiveVar([]);
    this.indexBoardUserArr.set(aa);

    this.titleArrV = new ReactiveVar([]);
    this.titleArrV.set(bb);
    //-------------标签统计  设置统计列------------------
    this.titleArrV1 = new ReactiveVar([]);
    this.titleArrV1.set(bb1);

    //-------------------------modified by lvbing------------------------------------------
    //筛选列表
    const popMenuToggleArr = this.popMenuToggleArrV1.get();
    const popIds = [];
    for (let s = 0; s < popMenuToggleArr.length; s++) {
      if (popMenuToggleArr[s].checked) popIds.push(popMenuToggleArr[s].popId);
    }
    // console.log("----------popIds-------", popIds);

    //筛选人员
    const popMenu1ToggleArr1 = this.popMenu1ToggleArrV1.get();
    const popMemIds = [];
    for (let s = 0; s < popMenu1ToggleArr1.length; s++) {
      if (popMenu1ToggleArr1[s].checked)
        popMemIds.push(popMenu1ToggleArr1[s].popId);
    }
    // console.log("----------popMemIds-------", popMemIds);

    /**新增颜色码值转换 */
    const extentLabelColors = [];
    extentLabelColors.push({
      'c-darkred-0': '#9f1a1a',
      'c-darkred-1': '#d95050',
      'c-darkred-2': '#f28a8a',
      'c-darkred-3': '#fcbaba',
      'c-darkred-4': '#ffe2e2',

      'c-darkorange-0': '#be572c',
      'c-darkorange-1': '#e16f6f',
      'c-darkorange-2': '#f99a71',
      'c-darkorange-3': '#fdb384',
      'c-darkorange-4': '#ffe5d4',

      'c-darkgray-0': '#7a4e1e',
      'c-darkgray-1': '#bd8e5d',
      'c-darkgray-2': '#e0b07c',
      'c-darkgray-3': '#f6d2ac',
      'c-darkgray-4': '#f2e4d5',

      'c-darkpurple-0': '#4e2471',
      'c-darkpurple-1': '#8e4aa9',
      'c-darkpurple-2': '#c78cde',
      'c-darkpurple-3': '#e1b6ea',
      'c-darkpurple-4': '#f2d9f8',

      'c-darkblue-0': '#145a91',
      'c-darkblue-1': '#4f8dbb',
      'c-darkblue-2': '#73b9eb',
      'c-darkblue-3': '#abd8fa',
      'c-darkblue-4': '#e1f2ff',

      'c-darkseagreen-0': '#069091',
      'c-darkseagreen-1': '#22c6ca',
      'c-darkseagreen-2': '#7adadf',
      'c-darkseagreen-3': '#b1f0fa',
      'c-darkseagreen-4': '#d5f7fa',

      'c-darkgreen-0': '#2d6e43',
      'c-darkgreen-1': '#5ca685',
      'c-darkgreen-2': '#86ccad',
      'c-darkgreen-3': '#bae5d2',
      'c-darkgreen-4': '#e5faf1',
    });

    //无标签卡片数量
    let indexLabelCardCount1 = 0;
    for (let i = 0; i < this.lableArr.length; i++) {
      let indexLabelCardCount = 0;
      const label = this.lableArr[i];
      for (let j = 0; j < this.cardList.length; j++) {
        const card = this.cardList[j];
        const cardLabelIdArr = card.labelIds;
        // console.log("----------card.listId-------", card.listId);
        //当前卡片被指派人是否包含设置的统计人员
        let isMemberIncluded;
        for (let s = 0; s < popMemIds.length; s++) {
          //    if (_.contains(card.members, popMemIds[s])) {
          if (_.contains(card.assignees, popMemIds[s])) {
            isMemberIncluded = true;
            break;
          }
        }
        //列表和人员筛选
        //  if (_.contains(popIds, card.listId) && isMemberIncluded) {
        if (_.contains(popIds, card.listId)) {
          //判断当前卡片是否有标签，若有，继续；若无，则命名为“无标签”
          if (cardLabelIdArr.length !== 0) {
            for (let k = 0; k < cardLabelIdArr.length; k++) {
              const indexLabel = cardLabelIdArr[k];
              if (indexLabel === label._id) {
                indexLabelCardCount++;
              }
            }
          } else if (i === this.lableArr.length - 1) {
            //所有卡片只统计一次无标签情况
            indexLabelCardCount1++;
          }
        }
      }
      if (indexLabelCardCount !== 0) {
        const params = label.color;
        let mylabelColor = '';
        const extentLabelColor = extentLabelColors[0];
        if (params.indexOf('c-') !== -1) {
          mylabelColor = extentLabelColor[params];
        } else {
          mylabelColor = label.color;
        }
        this.seriesData.push({
          value: indexLabelCardCount,
          //  name: label.name,
          id: label._id,
          name: label.name === '' ? '未命名' : label.name,
          itemStyle: {
            normal: {
              // color: label.color,
              color: mylabelColor,
            },
          },
        });
      }
    }
    //所有标签统计完后，统计无标签卡片
    if (indexLabelCardCount1 !== 0) {
      this.seriesData.push({
        value: indexLabelCardCount1,
        id: 'noLabelId',
        name: '无标签',
        itemStyle: {
          normal: {
            color: '#000',
          },
        },
      });
    }
    this.getWeeklyReports = query => {
      this.mergedCards = new ReactiveVar([]);
      this.totalPage = new ReactiveVar(0);
      const boardId = Session.get('currentBoard');
      const fromDate = query.fromDate;
      const toDate = query.toDate;
      const currentPage = query.pageNo;
      const pageSize = query.pagesize; //每页显示行数
      var mergedCardsArr = [];
      var unCompletedCards = [];
      var completedCards = [];
      //筛选列表
      const popMenuToggleArr = this.popMenuToggleArrV2.get();
      const popIds = [];
      for (let s = 0; s < popMenuToggleArr.length; s++) {
        if (popMenuToggleArr[s].checked) popIds.push(popMenuToggleArr[s].popId);
      }
      //筛选统计人员
      const popMenu1ToggleArr2 = this.popMenu1ToggleArrV2.get();
      const popMemIds = [];
      for (let s = 0; s < popMenu1ToggleArr2.length; s++) {
        if (popMenu1ToggleArr2[s].checked)
          popMemIds.push(popMenu1ToggleArr2[s].popId);
      }

      Cards.find(
        {
          boardId: boardId,
          $or: [
            //创建时间在本周内
            {
              createdAt: {
                $lte: toDate,
                $gte: fromDate,
              },
            },
            //开始时间在本周及之前
            {
              startAt: {
                $lte: toDate,
              },
            },
            //未设置开始时间和完成时间
            {
              createdAt: {
                $lte: fromDate,
                $gte: toDate,
              },
              startAt: undefined,
              endAt: undefined,
            },
          ],
          endAt: undefined,
          archived: false,
        },
        {
          sort: {
            createdAt: -1,
          },
        },
      ).forEach((item, index) => {
        if (!!popMemIds) {
          //当前卡片被指派人是否包含设置的统计人员
          let isMemberIncluded;
          for (let s = 0; s < popMemIds.length; s++) {
            //当前标签无指派人或者包含设置的被指派人
            if (item.assignees.length === 0) {
              if (_.contains(popMemIds, 'noAssigneeId')) {
                isMemberIncluded = true;
                break;
              }
            } else if (_.contains(item.assignees, popMemIds[s])) {
              isMemberIncluded = true;
              break;
            }
          }
          if (_.contains(popIds, item.listId) && isMemberIncluded) {
            unCompletedCards.push(item);
          }
        }
      });
      //已完成的任务
      Cards.find(
        {
          boardId: boardId,
          endAt: { $lte: toDate, $gte: fromDate },
          archived: false,
        },
        {
          sort: {
            endAt: -1,
          },
        },
      ).forEach((item, index) => {
        if (!!popMemIds) {
          //当前卡片被指派人是否包含设置的统计人员
          let isMemberIncluded;
          for (let s = 0; s < popMemIds.length; s++) {
            //当前标签无指派人或者包含设置的被指派人
            if (item.assignees.length === 0) {
              if (_.contains(popMemIds, 'noAssigneeId')) {
                isMemberIncluded = true;
                break;
              }
            } else if (_.contains(item.assignees, popMemIds[s])) {
              isMemberIncluded = true;
              break;
            }
          }
          if (_.contains(popIds, item.listId) && isMemberIncluded) {
            completedCards.push(item);
          }
        }
      });

      mergedCardsArr = unCompletedCards.concat(completedCards);

      if (!!mergedCardsArr) {
        for (let i = 0; i < mergedCardsArr.length; i++) {
          //成员列表
          const members = mergedCardsArr[i].members;
          let cardMembers = [];
          if (!!members) {
            for (let i = 0; i < this.aaNew.length; i++) {
              if (_.contains(members, this.aaNew[i].userId))
                cardMembers.push(this.aaNew[i]);
            }
          }
          mergedCardsArr[i].cardMembers = cardMembers;
          //指派人列表
          const assignees = mergedCardsArr[i].assignees;
          let cardAssignees = [];
          if (!!assignees) {
            for (let i = 0; i < this.aa.length; i++) {
              if (_.contains(assignees, this.aa[i].userId))
                cardAssignees.push(this.aa[i]);
            }
          }
          mergedCardsArr[i].cardAssignees = cardAssignees;
          //标签列表
          const labels = mergedCardsArr[i].labelIds;
          let cardLabels = [];
          if (!!labels) {
            for (let i = 0; i < this.lableArr.length; i++) {
              if (_.contains(labels, this.lableArr[i]._id))
                cardLabels.push(this.lableArr[i]);
            }
          }
          mergedCardsArr[i].cardLabels = cardLabels;
        }
      }
      console.log(mergedCardsArr);
      let arr =[];
      let arr1 =[];
      mergedCardsArr.forEach((ele,index)=>{
        if(ele.assignees.length===0){
          arr.push(ele);
        }
        else{
          arr1.push(ele);
        }
      })
     // console.log(arr1);
     // console.log(arr);
     // console.log(mergedCardsArr);
      let arr2=[];
      for(let i=0;i<arr1.length;i++){
        arr2.push(arr1[i]);
        for(let j=i+1;j<arr1.length;j++){
          if(arr1[i].cardAssignees[0].userId === arr1[j].cardAssignees[0].userId){
            console.log(arr1[i].cardAssignees[0].userId);
            console.log(arr1[j].cardAssignees[0].userId);
            arr2.push(arr1[j]);
            arr1.splice(j,1);
            j--;
          }
        }
     }
     //console.log(arr2);
     mergedCardsArr = arr2.concat(arr);
     //console.log(mergedCardsArr);
      //分页计算
      var num = mergedCardsArr.length; //表格所有行数(所有记录数)
      var totalPage = 0; //总页数

      //总共分几页
      if (num / pageSize < 1) {
        totalPage = 1;
      } else if (num / pageSize > parseInt(num / pageSize)) {
        totalPage = parseInt(num / pageSize) + 1;
      } else {
        totalPage = parseInt(num / pageSize);
      }
      var startRow = (currentPage - 1) * pageSize + 1; //开始显示的行 31
      var endRow = currentPage * pageSize; //结束显示的行  40
      endRow = endRow > num ? num : endRow; //40
      const pageArr = []; //遍历显示数据实现分页
      for (let i = 0; i < mergedCardsArr.length; i++) {
        if (i >= startRow - 1 && i <= endRow - 1) {
          pageArr.push(mergedCardsArr[i]);
        }
      }
      // console.log(pageArr);
      this.totalPage.set(totalPage);
      this.mergedCards.set(pageArr);
      return this.mergedCards;
    };
    this.weekUsersInfo = () => {
      //     const curDate = new Date();
      //     const preDate = new Date(curDate.getTime() - 24*60*60*1000); //前一天
      //     const nextDate = new Date(curDate.getTime() + 24*60*60*1000); //后一天
      let query = {
        fromDate: this.startTime,
        toDate: this.endTime,
        pageNo: this.pageNo,
        pagesize: this.pageSize,
      };
      // console.log(query);
      // console.log(this.getWeeklyReports(query));
      let data = this.getWeeklyReports(query).get();
      //console.log(data);
      let array = [];
      for (let i = 0; i < data.length; i++) {
        let obj = {};

        // if (data[i].cardAssignees) {
        //   // var person = [];
        //   // data[i].cardAssignees.forEach((ele, index) => {
        //   //   person.push(ele.userName);
        //   // });
        //   // obj.assignees = person.join(',');
        //   obj.assignees = data[i].cardAssignees
        // } else {
        //   obj.assignees = '';
        // }
        obj.assignees = data[i].cardAssignees
        if (data[i].createdAt) {
          obj.createdAt = new Date(data[i].createdAt).toLocaleString();
        } else {
          obj.createdAt = '';
        }
        if (data[i].title) {
          obj.title = data[i].title;
        } else {
          obj.title = '';
        }
        if (data[i].endAt) {
          obj.endAt = data[i].endAt;
        } else {
          obj.endAt = '';
        }
        if (
          data[i].startAt &&
          data[i].endAt &&
          data[i].endAt > data[i].startAt
        ) {
          var s1 = new Date(data[i].startAt).getTime(); //时间戳
          var s2 = new Date(data[i].endAt).getTime(); //时间戳
          var total = (s2 - s1) / 1000;
          var day = parseInt(total / (24 * 60 * 60)); //计算整数天数
          var afterDay = total - day * 24 * 60 * 60; //取得算出天数后剩余的秒数
          var hour = parseInt(afterDay / (60 * 60)); //计算整数小时数
          var afterHour = total - day * 24 * 60 * 60 - hour * 60 * 60; //取得算出小时数后剩余的秒数
          var min = parseInt(afterHour / 60); //计算整数分
          var afterMin = total - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
          var time = day + '天' + hour + '小时' + min + '分';
          if (day == 0) {
            time = hour + '小时' + min + '分';
          }
          if (hour == 0 && day == 0) {
            time = min + '分';
          }
          if (hour == 0 && day == 0 && min == 0) {
            time = afterMin + '秒';
          }
          obj.time = time;
        }
        else if (!data[i].endAt && data[i].startAt) {
          var s1 = new Date(data[i].startAt).getTime(); //时间戳
          var s2 = new Date().getTime(); //时间戳
          if (s2 - s1) {
            var total = (s2 - s1) / 1000;
            var day = parseInt(total / (24 * 60 * 60)); //计算整数天数
            var afterDay = total - day * 24 * 60 * 60; //取得算出天数后剩余的秒数
            var hour = parseInt(afterDay / (60 * 60)); //计算整数小时数
            var afterHour = total - day * 24 * 60 * 60 - hour * 60 * 60; //取得算出小时数后剩余的秒数
            var min = parseInt(afterHour / 60); //计算整数分
            var afterMin =
              total - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
            var time = day + '天' + hour + '小时' + min + '分';
            if (day == 0) {
              time = hour + '小时' + min + '分';
            }
            if (min == 0) {
              time = day + '天' + hour + '小时';
            }
            if (afterMin == 0) {
              //console.log(afterMin);
              time = day + '天' + hour + '小时' + min + '分';
            }
            if (hour == 0 && day == 0) {
              time = min + '分';
            }
            if (hour == 0 && day == 0 && min == 0) {
              time = afterMin + '秒';
            }
            obj.time = time;
          } else {
            obj.time = '';
          }
        } else {
          obj.time = '';
        }
        obj.cardLabels = data[i].cardLabels;
        // var cardMembers = [];
        // data[i].cardMembers.forEach((ele, index) => {
        //   cardMembers.push(ele.userName);
        // });
        obj.cardMembers =data[i].cardMembers;
        //obj.id = `board/${data[i]['_id']}`;
        obj.id = `${data[i]['_id']}`;
        obj.boardId = data[i].boardId;
        let keys = Object.keys(obj);
        let key = 'key';
        for (let i = 0; i < keys.length; i++) {
          key = key + i;
          obj[key] = keys[i];
          key = 'key';
          // console.log(obj);
        }
        array.push(obj);
      }
      // console.log(d1);
      // console.log(q1);
      // if(d1!=0&&q1!=0){
      //   let a = q1;
      //   array.forEach(function(item,index){
      //     let pro = item[q1];
      //     item[q1] =item[d1];
      //     item[d1] =pro;
      //   })
      // }
     // console.log(array.length);
     // array = this.fn(array,'userId');
     // console.log(array);
  //   let arr =[];
  //   let arr1 =[];
  //   array.forEach((ele,index)=>{
  //     if(ele.assignees.length===0){
  //       arr.push(ele);
  //     }
  //     else{
  //       arr1.push(ele);
  //     }
  //   })
  //  // console.log(arr1);
  //  // console.log(arr);
  //   let arr2=[];
  //   for(let i=0;i<arr1.length;i++){
  //     arr2.push(arr1[i]);
  //     for(let j=i+1;j<arr1.length;j++){
  //       if(arr1[i].assignees[0].userId === arr1[j].assignees[0].userId){
  //         console.log(arr1[i].assignees[0].userId);
  //         console.log(arr1[j].assignees[0].userId);
  //         arr2.push(arr1[j]);
  //         arr1.splice(j,1);
  //         j--;
  //       }
  //     }
  //  }
  //  //console.log(arr2);
  //   array = arr2.concat(arr);
    //console.log(array);
    return array;
    };
    this.dataArray = this.weekUsersInfo();
    this.dataArr.set(this.dataArray);
  },
  onRendered() {
    this.getSvg();
    if (window.screen.width <= 800) {
      document.querySelector('.js-expandD').style.display = 'none';
    }
    !(function(t, a, e, i) {
      var n = function(a, e) {
        (this.ele = a),
          (this.defaults = {
            currentPage: 1,
            totalPage: 10,
            isShow: !0,
            count: 5,
            homePageText: '首页',
            endPageText: '尾页',
            prevPageText: '上一页',
            nextPageText: '下一页',
            callback: function() {},
          }),
          (this.opts = t.extend({}, this.defaults, e)),
          (this.current = this.opts.currentPage),
          (this.total = this.opts.totalPage),
          this.init();
      };
      (n.prototype = {
        init: function() {
          this.render(), this.eventBind();
        },
        render: function() {
          var t = this.opts,
            a = this.current,
            e = this.total,
            i = this.getPagesTpl(),
            n = this.ele.empty();
          (this.isRender = !0),
            (this.homePage =
              '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="1">' +
              t.homePageText +
              '</a>'),
            (this.prevPage =
              '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
              (a - 1) +
              '">' +
              t.prevPageText +
              '</a>'),
            (this.nextPage =
              '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
              (a + 1) +
              '">' +
              t.nextPageText +
              '</a>'),
            (this.endPage =
              '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
              e +
              '">' +
              t.endPageText +
              '</a>'),
            this.checkPage(),
            this.isRender &&
              n.html(
                "<div class='ui-pagination-container'>" +
                  this.homePage +
                  this.prevPage +
                  i +
                  this.nextPage +
                  this.endPage +
                  '</div>',
              );
        },
        checkPage: function() {
          var t = this.opts,
            a = this.total,
            e = this.current;
          t.isShow || (this.homePage = this.endPage = ''),
            1 === e && (this.homePage = this.prevPage = ''),
            e === a && (this.endPage = this.nextPage = ''),
            1 === a &&
              (this.homePage = this.prevPage = this.endPage = this.nextPage =
                ''),
            a <= 1 && (this.isRender = !1);
        },
        getPagesTpl: function() {
          var t = this.opts,
            a = this.total,
            e = this.current,
            i = '',
            n = t.count;
          if (a <= n)
            for (g = 1; g <= a; g++)
              i +=
                g === e
                  ? '<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' +
                    g +
                    '">' +
                    g +
                    '</a>'
                  : '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
                    g +
                    '">' +
                    g +
                    '</a>';
          else {
            var s = n / 2;
            if (e <= s)
              for (g = 1; g <= n; g++)
                i +=
                  g === e
                    ? '<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' +
                      g +
                      '">' +
                      g +
                      '</a>'
                    : '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
                      g +
                      '">' +
                      g +
                      '</a>';
            else {
              var r = Math.floor(s),
                h = e + r,
                o = e - r,
                c = n % 2 == 0;
              h > a &&
                (c ? ((o -= h - a - 1), (h = a + 1)) : ((o -= h - a), (h = a))),
                c || h++;
              for (var g = o; g < h; g++)
                i +=
                  g === e
                    ? '<a href="javascript:void(0);" class="ui-pagination-page-item active" data-current="' +
                      g +
                      '">' +
                      g +
                      '</a>'
                    : '<a href="javascript:void(0);" class="ui-pagination-page-item" data-current="' +
                      g +
                      '">' +
                      g +
                      '</a>';
            }
          }
          return i;
        },
        setPage: function(t, a) {
          return t === this.current && a === this.total
            ? this.ele
            : ((this.current = t), (this.total = a), this.render(), this.ele);
        },
        getPage: function() {
          return { current: this.current, total: this.total };
        },
        eventBind: function() {
          var a = this,
            e = this.opts.callback;
          this.ele
            .off('click')
            .on('click', '.ui-pagination-page-item', function() {
              var i = t(this).data('current');
              a.current != i &&
                ((a.current = i),
                a.render(),
                e && 'function' == typeof e && e(i));
            });
        },
      }),
        (t.fn.pagination = function(t, a, e) {
          if ('object' == typeof t) {
            var i = new n(this, t);
            this.data('pagination', i);
          }
          return 'string' == typeof t ? this.data('pagination')[t](a, e) : this;
        });
    })(jQuery, window, document);
    /*! layDate v5.3.1 | 日期与时间组件 | MIT Licensed */
    /*! layDate v5.3.1 | 日期与时间组件 | MIT Licensed */
    !(function(e) {
      'use strict';
      var t = e.document,
        n = { modules: {}, status: {}, timeout: 10, event: {} },
        a = function() {
          this.v = '2.6.7';
        },
        r = e.LAYUI_GLOBAL || {},
        i = (function() {
          var e = t.currentScript
            ? t.currentScript.src
            : (function() {
                for (var e, n = t.scripts, a = n.length - 1, r = a; r > 0; r--)
                  if ('interactive' === n[r].readyState) {
                    e = n[r].src;
                    break;
                  }
                return e || n[a].src;
              })();
          return (n.dir = r.dir || e.substring(0, e.lastIndexOf('/') + 1));
        })(),
        o = function(t, n) {
          (n = n || 'log'),
            e.console && console[n] && console[n]('layui error hint: ' + t);
        },
        l =
          'undefined' != typeof opera && '[object Opera]' === opera.toString(),
        s = (n.builtin = {
          lay: 'lay',
          layer: 'layer',
          laydate: 'laydate',
          laypage: 'laypage',
          laytpl: 'laytpl',
          layedit: 'layedit',
          form: 'form',
          upload: 'upload',
          dropdown: 'dropdown',
          transfer: 'transfer',
          tree: 'tree',
          table: 'table',
          element: 'element',
          rate: 'rate',
          colorpicker: 'colorpicker',
          slider: 'slider',
          carousel: 'carousel',
          flow: 'flow',
          util: 'util',
          code: 'code',
          jquery: 'jquery',
          all: 'all',
          'layui.all': 'layui.all',
        });
      (a.prototype.cache = n),
        (a.prototype.define = function(e, t) {
          var a = this,
            r = 'function' == typeof e,
            i = function() {
              var e = function(e, t) {
                (u[e] = t), (n.status[e] = !0);
              };
              return (
                'function' == typeof t &&
                  t(function(a, r) {
                    e(a, r),
                      (n.callback[a] = function() {
                        t(e);
                      });
                  }),
                this
              );
            };
          return r && ((t = e), (e = [])), a.use(e, i, null, 'define'), a;
        }),
        (a.prototype.use = function(a, r, c, y) {
          function d(e, t) {
            var a =
              'PLaySTATION 3' === navigator.platform
                ? /^complete$/
                : /^(complete|loaded)$/;
            ('load' === e.type ||
              a.test((e.currentTarget || e.srcElement).readyState)) &&
              ((n.modules[g] = t),
              p.removeChild(w),
              (function r() {
                return ++v > (1e3 * n.timeout) / 4
                  ? o(g + ' is not a valid module', 'error')
                  : void (n.status[g] ? m() : setTimeout(r, 4));
              })());
          }
          function m() {
            c.push(u[g]),
              a.length > 1
                ? f.use(a.slice(1), r, c, y)
                : 'function' == typeof r &&
                  (function() {
                    return u.jquery &&
                      'function' == typeof u.jquery &&
                      'define' !== y
                      ? u.jquery(function() {
                          r.apply(u, c);
                        })
                      : void r.apply(u, c);
                  })();
          }
          var f = this,
            h = (n.dir = n.dir ? n.dir : i),
            p = t.getElementsByTagName('head')[0];
          (a = (function() {
            return 'string' == typeof a
              ? [a]
              : 'function' == typeof a
              ? ((r = a), ['all'])
              : a;
          })()),
            e.jQuery &&
              jQuery.fn.on &&
              (f.each(a, function(e, t) {
                'jquery' === t && a.splice(e, 1);
              }),
              (u.jquery = u.$ = jQuery));
          var g = a[0],
            v = 0;
          if (
            ((c = c || []),
            (n.host =
              n.host ||
              (h.match(/\/\/([\s\S]+?)\//) || ['//' + location.host + '/'])[0]),
            0 === a.length || (u['layui.all'] && s[g]))
          )
            return m(), f;
          var T =
            (s[g]
              ? h + 'modules/'
              : /^\{\/\}/.test(f.modules[g])
              ? ''
              : n.base || '') +
            (f.modules[g] || g) +
            '.js';
          if (
            ((T = T.replace(/^\{\/\}/, '')),
            !n.modules[g] && u[g] && (n.modules[g] = T),
            n.modules[g])
          )
            !(function D() {
              return ++v > (1e3 * n.timeout) / 4
                ? o(g + ' is not a valid module', 'error')
                : void ('string' == typeof n.modules[g] && n.status[g]
                    ? m()
                    : setTimeout(D, 4));
            })();
          else {
            var w = t.createElement('script');
            (w.async = !0),
              (w.charset = 'utf-8'),
              (w.src =
                T +
                (function() {
                  var e =
                    n.version === !0
                      ? n.v || new Date().getTime()
                      : n.version || '';
                  return e ? '?v=' + e : '';
                })()),
              p.appendChild(w),
              !w.attachEvent ||
              (w.attachEvent.toString &&
                w.attachEvent.toString().indexOf('[native code') < 0) ||
              l
                ? w.addEventListener(
                    'load',
                    function(e) {
                      d(e, T);
                    },
                    !1,
                  )
                : w.attachEvent('onreadystatechange', function(e) {
                    d(e, T);
                  }),
              (n.modules[g] = T);
          }
          return f;
        }),
        (a.prototype.getStyle = function(t, n) {
          var a = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
          return a[a.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](n);
        }),
        (a.prototype.link = function(e, a, r) {
          var i = this,
            l = t.getElementsByTagName('head')[0],
            s = t.createElement('link');
          'string' == typeof a && (r = a);
          var c = (r || e).replace(/\.|\//g, ''),
            u = (s.id = 'layuicss-' + c),
            y = 'creating',
            d = 0;
          return (
            (s.rel = 'stylesheet'),
            (s.href = e + (n.debug ? '?v=' + new Date().getTime() : '')),
            (s.media = 'all'),
            t.getElementById(u) || l.appendChild(s),
            'function' != typeof a
              ? i
              : ((function m(r) {
                  var l = 100,
                    s = t.getElementById(u);
                  return ++d > (1e3 * n.timeout) / l
                    ? o(e + ' timeout')
                    : void (1989 === parseInt(i.getStyle(s, 'width'))
                        ? (r === y && s.removeAttribute('lay-status'),
                          s.getAttribute('lay-status') === y
                            ? setTimeout(m, l)
                            : a())
                        : (s.setAttribute('lay-status', y),
                          setTimeout(function() {
                            m(y);
                          }, l)));
                })(),
                i)
          );
        }),
        (a.prototype.addcss = function(e, t, a) {
          return u.link(n.dir + 'css/' + e, t, a);
        }),
        (n.callback = {}),
        (a.prototype.factory = function(e) {
          if (u[e])
            return 'function' == typeof n.callback[e] ? n.callback[e] : null;
        }),
        (a.prototype.img = function(e, t, n) {
          var a = new Image();
          return (
            (a.src = e),
            a.complete
              ? t(a)
              : ((a.onload = function() {
                  (a.onload = null), 'function' == typeof t && t(a);
                }),
                void (a.onerror = function(e) {
                  (a.onerror = null), 'function' == typeof n && n(e);
                }))
          );
        }),
        (a.prototype.config = function(e) {
          e = e || {};
          for (var t in e) n[t] = e[t];
          return this;
        }),
        (a.prototype.modules = (function() {
          var e = {};
          for (var t in s) e[t] = s[t];
          return e;
        })()),
        (a.prototype.extend = function(e) {
          var t = this;
          e = e || {};
          for (var n in e)
            t[n] || t.modules[n]
              ? o(n + ' Module already exists', 'error')
              : (t.modules[n] = e[n]);
          return t;
        }),
        (a.prototype.router = function(e) {
          var t = this,
            e = e || location.hash,
            n = {
              path: [],
              search: {},
              hash: (e.match(/[^#](#.*$)/) || [])[1] || '',
            };
          return /^#\//.test(e)
            ? ((e = e.replace(/^#\//, '')),
              (n.href = '/' + e),
              (e = e.replace(/([^#])(#.*$)/, '$1').split('/') || []),
              t.each(e, function(e, t) {
                /^\w+=/.test(t)
                  ? (function() {
                      (t = t.split('=')), (n.search[t[0]] = t[1]);
                    })()
                  : n.path.push(t);
              }),
              n)
            : n;
        }),
        (a.prototype.url = function(e) {
          var t = this,
            n = {
              pathname: (function() {
                var t = e
                  ? (function() {
                      var t = (e.match(/\.[^.]+?\/.+/) || [])[0] || '';
                      return t.replace(/^[^\/]+/, '').replace(/\?.+/, '');
                    })()
                  : location.pathname;
                return t.replace(/^\//, '').split('/');
              })(),
              search: (function() {
                var n = {},
                  a = (e
                    ? (function() {
                        var t = (e.match(/\?.+/) || [])[0] || '';
                        return t.replace(/\#.+/, '');
                      })()
                    : location.search
                  )
                    .replace(/^\?+/, '')
                    .split('&');
                return (
                  t.each(a, function(e, t) {
                    var a = t.indexOf('='),
                      r = (function() {
                        return a < 0
                          ? t.substr(0, t.length)
                          : 0 !== a && t.substr(0, a);
                      })();
                    r && (n[r] = a > 0 ? t.substr(a + 1) : null);
                  }),
                  n
                );
              })(),
              hash: t.router(
                (function() {
                  return e ? (e.match(/#.+/) || [])[0] || '/' : location.hash;
                })(),
              ),
            };
          return n;
        }),
        (a.prototype.data = function(t, n, a) {
          if (
            ((t = t || 'layui'),
            (a = a || localStorage),
            e.JSON && e.JSON.parse)
          ) {
            if (null === n) return delete a[t];
            n = 'object' == typeof n ? n : { key: n };
            try {
              var r = JSON.parse(a[t]);
            } catch (i) {
              var r = {};
            }
            return (
              'value' in n && (r[n.key] = n.value),
              n.remove && delete r[n.key],
              (a[t] = JSON.stringify(r)),
              n.key ? r[n.key] : r
            );
          }
        }),
        (a.prototype.sessionData = function(e, t) {
          return this.data(e, t, sessionStorage);
        }),
        (a.prototype.device = function(t) {
          var n = navigator.userAgent.toLowerCase(),
            a = function(e) {
              var t = new RegExp(e + '/([^\\s\\_\\-]+)');
              return (e = (n.match(t) || [])[1]), e || !1;
            },
            r = {
              os: (function() {
                return /windows/.test(n)
                  ? 'windows'
                  : /linux/.test(n)
                  ? 'linux'
                  : /iphone|ipod|ipad|ios/.test(n)
                  ? 'ios'
                  : /mac/.test(n)
                  ? 'mac'
                  : void 0;
              })(),
              ie: (function() {
                return (
                  !!(e.ActiveXObject || 'ActiveXObject' in e) &&
                  ((n.match(/msie\s(\d+)/) || [])[1] || '11')
                );
              })(),
              weixin: a('micromessenger'),
            };
          return (
            t && !r[t] && (r[t] = a(t)),
            (r.android = /android/.test(n)),
            (r.ios = 'ios' === r.os),
            (r.mobile = !(!r.android && !r.ios)),
            r
          );
        }),
        (a.prototype.hint = function() {
          return { error: o };
        }),
        (a.prototype._typeof = function(e) {
          return null === e
            ? String(e)
            : 'object' == typeof e || 'function' == typeof e
            ? (function() {
                var t =
                    Object.prototype.toString.call(e).match(/\s(.+)\]$/) || [],
                  n = 'Function|Array|Date|RegExp|Object|Error|Symbol';
                return (
                  (t = t[1] || 'Object'),
                  new RegExp('\\b(' + n + ')\\b').test(t)
                    ? t.toLowerCase()
                    : 'object'
                );
              })()
            : typeof e;
        }),
        (a.prototype._isArray = function(t) {
          var n,
            a = this,
            r = a._typeof(t);
          return (
            !(!t || 'object' != typeof t || t === e) &&
            ((n = 'length' in t && t.length),
            'array' === r ||
              0 === n ||
              ('number' == typeof n && n > 0 && n - 1 in t))
          );
        }),
        (a.prototype.each = function(e, t) {
          var n,
            a = this,
            r = function(e, n) {
              return t.call(n[e], e, n[e]);
            };
          if ('function' != typeof t) return a;
          if (((e = e || []), a._isArray(e)))
            for (n = 0; n < e.length && !r(n, e); n++);
          else for (n in e) if (r(n, e)) break;
          return a;
        }),
        (a.prototype.sort = function(e, t, n) {
          var a = JSON.parse(JSON.stringify(e || []));
          return t
            ? (a.sort(function(e, n) {
                var a = /^-?\d+$/,
                  r = e[t],
                  i = n[t];
                return (
                  a.test(r) && (r = parseFloat(r)),
                  a.test(i) && (i = parseFloat(i)),
                  r - i
                );
              }),
              n && a.reverse(),
              a)
            : a;
        }),
        (a.prototype.stope = function(t) {
          t = t || e.event;
          try {
            t.stopPropagation();
          } catch (n) {
            t.cancelBubble = !0;
          }
        });
      var c = 'LAYUI-EVENT-REMOVE';
      (a.prototype.onevent = function(e, t, n) {
        return 'string' != typeof e || 'function' != typeof n
          ? this
          : a.event(e, t, null, n);
      }),
        (a.prototype.event = a.event = function(e, t, a, r) {
          var i = this,
            o = null,
            l = (t || '').match(/\((.*)\)$/) || [],
            s = (e + '.' + t).replace(l[0], ''),
            y = l[1] || '',
            d = function(e, t) {
              var n = t && t.call(i, a);
              n === !1 && null === o && (o = !1);
            };
          return a === c
            ? (delete (i.cache.event[s] || {})[y], i)
            : r
            ? ((n.event[s] = n.event[s] || {}), (n.event[s][y] = [r]), this)
            : (u.each(n.event[s], function(e, t) {
                return '{*}' === y
                  ? void u.each(t, d)
                  : ('' === e && u.each(t, d),
                    void (y && e === y && u.each(t, d)));
              }),
              o);
        }),
        (a.prototype.on = function(e, t, n) {
          var a = this;
          return a.onevent.call(a, t, e, n);
        }),
        (a.prototype.off = function(e, t) {
          var n = this;
          return n.event.call(n, t, e, c);
        });
      var u = new a(),
        y = 'lay',
        d = window.document,
        m = function(e) {
          return new f(e);
        },
        f = function(e) {
          for (
            var t = 0,
              n =
                'object' == typeof e
                  ? [e]
                  : ((this.selector = e), d.querySelectorAll(e || null));
            t < n.length;
            t++
          )
            this.push(n[t]);
        };
      (f.prototype = []),
        (f.prototype.constructor = f),
        (m.extend = function() {
          var e = 1,
            t = arguments,
            n = function(e, t) {
              e = e || (t.constructor === Array ? [] : {});
              for (var a in t)
                e[a] =
                  t[a] && t[a].constructor === Object ? n(e[a], t[a]) : t[a];
              return e;
            };
          for (t[0] = 'object' == typeof t[0] ? t[0] : {}; e < t.length; e++)
            'object' == typeof t[e] && n(t[0], t[e]);
          return t[0];
        }),
        (m.v = '1.0.7'),
        (m.ie = (function() {
          var e = navigator.userAgent.toLowerCase();
          return (
            !!(window.ActiveXObject || 'ActiveXObject' in window) &&
            ((e.match(/msie\s(\d+)/) || [])[1] || '11')
          );
        })()),
        (m.layui = u),
        (m.getPath = u.cache.dir),
        (m.stope = u.stope),
        (m.each = function() {
          return u.each.apply(u, arguments), this;
        }),
        (m.digit = function(e, t, n) {
          var a = '';
          (e = String(e)), (t = t || 2);
          for (var r = e.length; r < t; r++) a += '0';
          return e < Math.pow(10, t) ? a + (0 | e) : e;
        }),
        (m.elem = function(e, t) {
          var n = d.createElement(e);
          return (
            m.each(t || {}, function(e, t) {
              n.setAttribute(e, t);
            }),
            n
          );
        }),
        (m.hasScrollbar = function() {
          return (
            d.body.scrollHeight >
            (window.innerHeight || d.documentElement.clientHeight)
          );
        }),
        (m.position = function(e, t, n) {
          if (t) {
            (n = n || {}),
              (e !== d && e !== m('body')[0]) || (n.clickType = 'right');
            var a =
                'right' === n.clickType
                  ? (function() {
                      var e = n.e || window.event || {};
                      return {
                        left: e.clientX,
                        top: e.clientY,
                        right: e.clientX,
                        bottom: e.clientY,
                      };
                    })()
                  : e.getBoundingClientRect(),
              r = t.offsetWidth,
              i = t.offsetHeight,
              o = function(e) {
                return (
                  (e = e ? 'scrollLeft' : 'scrollTop'),
                  d.body[e] | d.documentElement[e]
                );
              },
              l = function(e) {
                return d.documentElement[e ? 'clientWidth' : 'clientHeight'];
              },
              s = 5,
              c = a.left,
              u = a.bottom;
            c + r + s > l('width') && (c = l('width') - r - s),
              u + i + s > l() &&
                (a.top > i + s
                  ? (u = a.top - i - 2 * s)
                  : 'right' === n.clickType &&
                    ((u = l() - i - 2 * s), u < 0 && (u = 0)));
            var y = n.position;
            if (
              (y && (t.style.position = y),
              (t.style.left = c + ('fixed' === y ? 0 : o(1)) + 'px'),
              (t.style.top = u + ('fixed' === y ? 0 : o()) + 'px'),
              !m.hasScrollbar())
            ) {
              var f = t.getBoundingClientRect();
              !n.SYSTEM_RELOAD &&
                f.bottom + s > l() &&
                ((n.SYSTEM_RELOAD = !0),
                setTimeout(function() {
                  m.position(e, t, n);
                }, 50));
            }
          }
        }),
        (m.options = function(e, t) {
          var n = m(e),
            a = t || 'lay-options';
          try {
            return new Function('return ' + (n.attr(a) || '{}'))();
          } catch (r) {
            return hint.error('parseerror\uff1a' + r, 'error'), {};
          }
        }),
        (m.isTopElem = function(e) {
          var t = [d, m('body')[0]],
            n = !1;
          return (
            m.each(t, function(t, a) {
              if (a === e) return (n = !0);
            }),
            n
          );
        }),
        (f.addStr = function(e, t) {
          return (
            (e = e.replace(/\s+/, ' ')),
            (t = t.replace(/\s+/, ' ').split(' ')),
            m.each(t, function(t, n) {
              new RegExp('\\b' + n + '\\b').test(e) || (e = e + ' ' + n);
            }),
            e.replace(/^\s|\s$/, '')
          );
        }),
        (f.removeStr = function(e, t) {
          return (
            (e = e.replace(/\s+/, ' ')),
            (t = t.replace(/\s+/, ' ').split(' ')),
            m.each(t, function(t, n) {
              var a = new RegExp('\\b' + n + '\\b');
              a.test(e) && (e = e.replace(a, ''));
            }),
            e.replace(/\s+/, ' ').replace(/^\s|\s$/, '')
          );
        }),
        (f.prototype.find = function(e) {
          var t = this,
            n = 0,
            a = [],
            r = 'object' == typeof e;
          return (
            this.each(function(i, o) {
              for (
                var l = r ? o.contains(e) : o.querySelectorAll(e || null);
                n < l.length;
                n++
              )
                a.push(l[n]);
              t.shift();
            }),
            r || (t.selector = (t.selector ? t.selector + ' ' : '') + e),
            m.each(a, function(e, n) {
              t.push(n);
            }),
            t
          );
        }),
        (f.prototype.each = function(e) {
          return m.each.call(this, this, e);
        }),
        (f.prototype.addClass = function(e, t) {
          return this.each(function(n, a) {
            a.className = f[t ? 'removeStr' : 'addStr'](a.className, e);
          });
        }),
        (f.prototype.removeClass = function(e) {
          return this.addClass(e, !0);
        }),
        (f.prototype.hasClass = function(e) {
          var t = !1;
          return (
            this.each(function(n, a) {
              new RegExp('\\b' + e + '\\b').test(a.className) && (t = !0);
            }),
            t
          );
        }),
        (f.prototype.css = function(e, t) {
          var n = this,
            a = function(e) {
              return isNaN(e) ? e : e + 'px';
            };
          return 'string' == typeof e && void 0 === t
            ? (function() {
                if (n.length > 0) return n[0].style[e];
              })()
            : n.each(function(n, r) {
                'object' == typeof e
                  ? m.each(e, function(e, t) {
                      r.style[e] = a(t);
                    })
                  : (r.style[e] = a(t));
              });
        }),
        (f.prototype.width = function(e) {
          var t = this;
          return void 0 === e
            ? (function() {
                if (t.length > 0) return t[0].offsetWidth;
              })()
            : t.each(function(n, a) {
                t.css('width', e);
              });
        }),
        (f.prototype.height = function(e) {
          var t = this;
          return void 0 === e
            ? (function() {
                if (t.length > 0) return t[0].offsetHeight;
              })()
            : t.each(function(n, a) {
                t.css('height', e);
              });
        }),
        (f.prototype.attr = function(e, t) {
          var n = this;
          return void 0 === t
            ? (function() {
                if (n.length > 0) return n[0].getAttribute(e);
              })()
            : n.each(function(n, a) {
                a.setAttribute(e, t);
              });
        }),
        (f.prototype.removeAttr = function(e) {
          return this.each(function(t, n) {
            n.removeAttribute(e);
          });
        }),
        (f.prototype.html = function(e) {
          var t = this;
          return void 0 === e
            ? (function() {
                if (t.length > 0) return t[0].innerHTML;
              })()
            : this.each(function(t, n) {
                n.innerHTML = e;
              });
        }),
        (f.prototype.val = function(e) {
          var t = this;
          return void 0 === e
            ? (function() {
                if (t.length > 0) return t[0].value;
              })()
            : this.each(function(t, n) {
                n.value = e;
              });
        }),
        (f.prototype.append = function(e) {
          return this.each(function(t, n) {
            'object' == typeof e
              ? n.appendChild(e)
              : (n.innerHTML = n.innerHTML + e);
          });
        }),
        (f.prototype.remove = function(e) {
          return this.each(function(t, n) {
            e ? n.removeChild(e) : n.parentNode.removeChild(n);
          });
        }),
        (f.prototype.on = function(e, t) {
          return this.each(function(n, a) {
            a.attachEvent
              ? a.attachEvent('on' + e, function(e) {
                  (e.target = e.srcElement), t.call(a, e);
                })
              : a.addEventListener(e, t, !1);
          });
        }),
        (f.prototype.off = function(e, t) {
          return this.each(function(n, a) {
            a.detachEvent
              ? a.detachEvent('on' + e, t)
              : a.removeEventListener(e, t, !1);
          });
        }),
        (window.lay = m),
        window.layui &&
          u.define &&
          u.define(function(e) {
            e(y, m);
          });
    })(window, window.document),
      !(function(e, t) {
        'use strict';
        var n = e.layui && layui.define,
          a = {
            getPath: e.lay && lay.getPath ? lay.getPath : '',
            link: function(t, n, a) {
              i.path && e.lay && lay.layui && lay.layui.link(i.path + t, n, a);
            },
          },
          r = e.LAYUI_GLOBAL || {},
          i = {
            v: '5.3.1',
            config: {},
            index: e.laydate && e.laydate.v ? 1e5 : 0,
            path: r.laydate_dir || a.getPath,
            set: function(e) {
              var t = this;
              return (t.config = lay.extend({}, t.config, e)), t;
            },
            ready: function(e) {
              var t = 'laydate',
                r = '',
                o =
                  (n ? 'modules/laydate/' : 'theme/') +
                  'default/laydate.css?v=' +
                  i.v +
                  r;
              return n ? layui.addcss(o, e, t) : a.link(o, e, t), this;
            },
          },
          o = function() {
            var e = this,
              t = e.config,
              n = t.id;
            return (
              (o.that[n] = e),
              {
                hint: function(t) {
                  e.hint.call(e, t);
                },
                config: e.config,
              }
            );
          },
          l = 'laydate',
          s = '.layui-laydate',
          c = 'layui-this',
          u = 'laydate-disabled',
          y = [100, 2e5],
          d = 'layui-laydate-static',
          m = 'layui-laydate-list',
          f = 'layui-laydate-hint',
          h = 'layui-laydate-footer',
          p = '.laydate-btns-confirm',
          g = 'laydate-time-text',
          v = 'laydate-btns-time',
          T = 'layui-laydate-preview',
          w = function(e) {
            var t = this;
            (t.index = ++i.index),
              (t.config = lay.extend({}, t.config, i.config, e)),
              (e = t.config),
              (e.id = 'id' in e ? e.id : t.index),
              i.ready(function() {
                t.init();
              });
          },
          D = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s';
        (o.formatArr = function(e) {
          return (e || '').match(new RegExp(D + '|.', 'g')) || [];
        }),
          (w.isLeapYear = function(e) {
            return (e % 4 === 0 && e % 100 !== 0) || e % 400 === 0;
          }),
          (w.prototype.config = {
            type: 'date',
            range: !1,
            format: 'yyyy-MM-dd',
            value: null,
            isInitValue: !0,
            min: '1900-1-1',
            max: '2099-12-31',
            trigger: 'click',
            show: !1,
            showBottom: !0,
            isPreview: !0,
            btns: ['clear', 'now', 'confirm'],
            lang: 'cn',
            theme: 'default',
            position: null,
            calendar: !1,
            mark: {},
            zIndex: null,
            done: null,
            change: null,
          }),
          (w.prototype.lang = function() {
            var e = this,
              t = e.config,
              n = {
                cn: {
                  weeks: [
                    '\u65e5',
                    '\u4e00',
                    '\u4e8c',
                    '\u4e09',
                    '\u56db',
                    '\u4e94',
                    '\u516d',
                  ],
                  time: ['\u65f6', '\u5206', '\u79d2'],
                  timeTips: '\u9009\u62e9\u65f6\u95f4',
                  startTime: '\u5f00\u59cb\u65f6\u95f4',
                  endTime: '\u7ed3\u675f\u65f6\u95f4',
                  dateTips: '\u8fd4\u56de\u65e5\u671f',
                  month: [
                    '\u4e00',
                    '\u4e8c',
                    '\u4e09',
                    '\u56db',
                    '\u4e94',
                    '\u516d',
                    '\u4e03',
                    '\u516b',
                    '\u4e5d',
                    '\u5341',
                    '\u5341\u4e00',
                    '\u5341\u4e8c',
                  ],
                  tools: {
                    confirm: '\u786e\u5b9a',
                    clear: '\u6e05\u7a7a',
                    now: '\u73b0\u5728',
                  },
                  timeout:
                    '\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4<br>\u8bf7\u91cd\u65b0\u9009\u62e9',
                  invalidDate:
                    '\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185',
                  formatError: [
                    '\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5<br>\u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a<br>',
                    '<br>\u5df2\u4e3a\u4f60\u91cd\u7f6e',
                  ],
                  preview: '\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c',
                },
                en: {
                  weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
                  time: ['Hours', 'Minutes', 'Seconds'],
                  timeTips: 'Select Time',
                  startTime: 'Start Time',
                  endTime: 'End Time',
                  dateTips: 'Select Date',
                  month: [
                    'Jan',
                    'Feb',
                    'Mar',
                    'Apr',
                    'May',
                    'Jun',
                    'Jul',
                    'Aug',
                    'Sep',
                    'Oct',
                    'Nov',
                    'Dec',
                  ],
                  tools: { confirm: 'Confirm', clear: 'Clear', now: 'Now' },
                  timeout:
                    'End time cannot be less than start Time<br>Please re-select',
                  invalidDate: 'Invalid date',
                  formatError: [
                    'The date format error<br>Must be followed\uff1a<br>',
                    '<br>It has been reset',
                  ],
                  preview: 'The selected result',
                },
              };
            return n[t.lang] || n.cn;
          }),
          (w.prototype.init = function() {
            var t = this,
              n = t.config,
              a = 'static' === n.position,
              r = {
                year: 'yyyy',
                month: 'yyyy-MM',
                date: 'yyyy-MM-dd',
                time: 'HH:mm:ss',
                datetime: 'yyyy-MM-dd HH:mm:ss',
              };
            (n.elem = lay(n.elem)),
              (n.eventElem = lay(n.eventElem)),
              n.elem[0] &&
                ((t.rangeStr = n.range
                  ? 'string' == typeof n.range
                    ? n.range
                    : '-'
                  : ''),
                n.range &&
                  n.range.constructor === Array &&
                  (t.rangeElem = [lay(n.range[0]), lay(n.range[1])]),
                r[n.type] ||
                  (e.console &&
                    console.error &&
                    console.error(
                      "laydate type error:'" + n.type + "' is not supported",
                    ),
                  (n.type = 'date')),
                n.format === r.date && (n.format = r[n.type] || r.date),
                (t.format = o.formatArr(n.format)),
                (t.EXP_IF = ''),
                (t.EXP_SPLIT = ''),
                lay.each(t.format, function(e, n) {
                  var a = new RegExp(D).test(n)
                    ? '\\d{' +
                      (function() {
                        return new RegExp(D).test(
                          t.format[0 === e ? e + 1 : e - 1] || '',
                        )
                          ? /^yyyy|y$/.test(n)
                            ? 4
                            : n.length
                          : /^yyyy$/.test(n)
                          ? '1,4'
                          : /^y$/.test(n)
                          ? '1,308'
                          : '1,2';
                      })() +
                      '}'
                    : '\\' + n;
                  (t.EXP_IF = t.EXP_IF + a),
                    (t.EXP_SPLIT = t.EXP_SPLIT + '(' + a + ')');
                }),
                (t.EXP_IF_ONE = new RegExp('^' + t.EXP_IF + '$')),
                (t.EXP_IF = new RegExp(
                  '^' +
                    (n.range
                      ? t.EXP_IF + '\\s\\' + t.rangeStr + '\\s' + t.EXP_IF
                      : t.EXP_IF) +
                    '$',
                )),
                (t.EXP_SPLIT = new RegExp('^' + t.EXP_SPLIT + '$', '')),
                t.isInput(n.elem[0]) ||
                  ('focus' === n.trigger && (n.trigger = 'click')),
                n.elem.attr('lay-key') ||
                  (n.elem.attr('lay-key', t.index),
                  n.eventElem.attr('lay-key', t.index)),
                (n.mark = lay.extend(
                  {},
                  n.calendar && 'cn' === n.lang
                    ? {
                        '0-1-1': '\u5143\u65e6',
                        '0-2-14': '\u60c5\u4eba',
                        '0-3-8': '\u5987\u5973',
                        '0-3-12': '\u690d\u6811',
                        '0-4-1': '\u611a\u4eba',
                        '0-5-1': '\u52b3\u52a8',
                        '0-5-4': '\u9752\u5e74',
                        '0-6-1': '\u513f\u7ae5',
                        '0-9-10': '\u6559\u5e08',
                        '0-9-18': '\u56fd\u803b',
                        '0-10-1': '\u56fd\u5e86',
                        '0-12-25': '\u5723\u8bde',
                      }
                    : {},
                  n.mark,
                )),
                lay.each(['min', 'max'], function(e, t) {
                  var a = [],
                    r = [];
                  if ('number' == typeof n[t]) {
                    var i = n[t],
                      o = new Date().getTime(),
                      l = 864e5,
                      s = new Date(i ? (i < l ? o + i * l : i) : o);
                    (a = [s.getFullYear(), s.getMonth() + 1, s.getDate()]),
                      i < l ||
                        (r = [s.getHours(), s.getMinutes(), s.getSeconds()]);
                  } else (a = (n[t].match(/\d+-\d+-\d+/) || [''])[0].split('-')), (r = (n[t].match(/\d+:\d+:\d+/) || [''])[0].split(':'));
                  n[t] = {
                    year: 0 | a[0] || new Date().getFullYear(),
                    month: a[1] ? (0 | a[1]) - 1 : new Date().getMonth(),
                    date: 0 | a[2] || new Date().getDate(),
                    hours: 0 | r[0],
                    minutes: 0 | r[1],
                    seconds: 0 | r[2],
                  };
                }),
                (t.elemID = 'layui-laydate' + n.elem.attr('lay-key')),
                (n.show || a) && t.render(),
                a || t.events(),
                n.value &&
                  n.isInitValue &&
                  (n.value.constructor === Date
                    ? t.setValue(t.parse(0, t.systemDate(n.value)))
                    : t.setValue(n.value)));
          }),
          (w.prototype.render = function() {
            var e = this,
              n = e.config,
              a = e.lang(),
              r = 'static' === n.position,
              o = (e.elem = lay.elem('div', {
                id: e.elemID,
                class: [
                  'layui-laydate',
                  n.range ? ' layui-laydate-range' : '',
                  r ? ' ' + d : '',
                  n.theme && 'default' !== n.theme && !/^#/.test(n.theme)
                    ? ' laydate-theme-' + n.theme
                    : '',
                ].join(''),
              })),
              l = (e.elemMain = []),
              s = (e.elemHeader = []),
              c = (e.elemCont = []),
              u = (e.table = []),
              y = (e.footer = lay.elem('div', { class: h }));
            if (
              (n.zIndex && (o.style.zIndex = n.zIndex),
              lay.each(new Array(2), function(e) {
                if (!n.range && e > 0) return !0;
                var t = lay.elem('div', { class: 'layui-laydate-header' }),
                  r = [
                    (function() {
                      var e = lay.elem('i', {
                        class: 'layui-icon laydate-icon laydate-prev-y',
                      });
                      return (e.innerHTML = '&#xe65a;'), e;
                    })(),
                    (function() {
                      var e = lay.elem('i', {
                        class: 'layui-icon laydate-icon laydate-prev-m',
                      });
                      return (e.innerHTML = '&#xe603;'), e;
                    })(),
                    (function() {
                      var e = lay.elem('div', { class: 'laydate-set-ym' }),
                        t = lay.elem('span'),
                        n = lay.elem('span');
                      return e.appendChild(t), e.appendChild(n), e;
                    })(),
                    (function() {
                      var e = lay.elem('i', {
                        class: 'layui-icon laydate-icon laydate-next-m',
                      });
                      return (e.innerHTML = '&#xe602;'), e;
                    })(),
                    (function() {
                      var e = lay.elem('i', {
                        class: 'layui-icon laydate-icon laydate-next-y',
                      });
                      return (e.innerHTML = '&#xe65b;'), e;
                    })(),
                  ],
                  i = lay.elem('div', { class: 'layui-laydate-content' }),
                  o = lay.elem('table'),
                  y = lay.elem('thead'),
                  d = lay.elem('tr');
                lay.each(r, function(e, n) {
                  t.appendChild(n);
                }),
                  y.appendChild(d),
                  lay.each(new Array(6), function(e) {
                    var t = o.insertRow(0);
                    lay.each(new Array(7), function(n) {
                      if (0 === e) {
                        var r = lay.elem('th');
                        (r.innerHTML = a.weeks[n]), d.appendChild(r);
                      }
                      t.insertCell(n);
                    });
                  }),
                  o.insertBefore(y, o.children[0]),
                  i.appendChild(o),
                  (l[e] = lay.elem('div', {
                    class: 'layui-laydate-main laydate-main-list-' + e,
                  })),
                  l[e].appendChild(t),
                  l[e].appendChild(i),
                  s.push(r),
                  c.push(i),
                  u.push(o);
              }),
              lay(y).html(
                (function() {
                  var e = [],
                    t = [];
                  return (
                    'datetime' === n.type &&
                      e.push(
                        '<span lay-type="datetime" class="' +
                          v +
                          '">' +
                          a.timeTips +
                          '</span>',
                      ),
                    (n.range || 'datetime' !== n.type) &&
                      e.push(
                        '<span class="' +
                          T +
                          '" title="' +
                          a.preview +
                          '"></span>',
                      ),
                    lay.each(n.btns, function(e, i) {
                      var o = a.tools[i] || 'btn';
                      (n.range && 'now' === i) ||
                        (r &&
                          'clear' === i &&
                          (o = 'cn' === n.lang ? '\u91cd\u7f6e' : 'Reset'),
                        t.push(
                          '<span lay-type="' +
                            i +
                            '" class="laydate-btns-' +
                            i +
                            '">' +
                            o +
                            '</span>',
                        ));
                    }),
                    e.push(
                      '<div class="laydate-footer-btns">' +
                        t.join('') +
                        '</div>',
                    ),
                    e.join('')
                  );
                })(),
              ),
              lay.each(l, function(e, t) {
                o.appendChild(t);
              }),
              n.showBottom && o.appendChild(y),
              /^#/.test(n.theme))
            ) {
              var m = lay.elem('style'),
                f = [
                  '#{{id}} .layui-laydate-header{background-color:{{theme}};}',
                  '#{{id}} .layui-this{background-color:{{theme}} !important;}',
                ]
                  .join('')
                  .replace(/{{id}}/g, e.elemID)
                  .replace(/{{theme}}/g, n.theme);
              'styleSheet' in m
                ? (m.setAttribute('type', 'text/css'),
                  (m.styleSheet.cssText = f))
                : (m.innerHTML = f),
                lay(o).addClass('laydate-theme-molv'),
                o.appendChild(m);
            }
            (i.thisId = n.id),
              e.remove(w.thisElemDate),
              r ? n.elem.append(o) : (t.body.appendChild(o), e.position()),
              e.checkDate().calendar(null, 0, 'init'),
              e.changeEvent(),
              (w.thisElemDate = e.elemID),
              'function' == typeof n.ready &&
                n.ready(
                  lay.extend({}, n.dateTime, { month: n.dateTime.month + 1 }),
                ),
              e.preview();
          }),
          (w.prototype.remove = function(e) {
            var t = this,
              n = (t.config, lay('#' + (e || t.elemID)));
            return n[0]
              ? (n.hasClass(d) ||
                  t.checkDate(function() {
                    n.remove();
                  }),
                t)
              : t;
          }),
          (w.prototype.position = function() {
            var e = this,
              t = e.config;
            return (
              lay.position(e.bindElem || t.elem[0], e.elem, {
                position: t.position,
              }),
              e
            );
          }),
          (w.prototype.hint = function(e) {
            var t = this,
              n = (t.config, lay.elem('div', { class: f }));
            t.elem &&
              ((n.innerHTML = e || ''),
              lay(t.elem)
                .find('.' + f)
                .remove(),
              t.elem.appendChild(n),
              clearTimeout(t.hinTimer),
              (t.hinTimer = setTimeout(function() {
                lay(t.elem)
                  .find('.' + f)
                  .remove();
              }, 3e3)));
          }),
          (w.prototype.getAsYM = function(e, t, n) {
            return (
              n ? t-- : t++,
              t < 0 && ((t = 11), e--),
              t > 11 && ((t = 0), e++),
              [e, t]
            );
          }),
          (w.prototype.systemDate = function(e) {
            var t = e || new Date();
            return {
              year: t.getFullYear(),
              month: t.getMonth(),
              date: t.getDate(),
              hours: e ? e.getHours() : 0,
              minutes: e ? e.getMinutes() : 0,
              seconds: e ? e.getSeconds() : 0,
            };
          }),
          (w.prototype.checkDate = function(e) {
            var t,
              n,
              a = this,
              r = (new Date(), a.config),
              o = a.lang(),
              l = (r.dateTime = r.dateTime || a.systemDate()),
              s = a.bindElem || r.elem[0],
              c =
                (a.isInput(s) ? 'val' : 'html',
                (function() {
                  if (a.rangeElem) {
                    var e = [a.rangeElem[0].val(), a.rangeElem[1].val()];
                    if (e[0] && e[1]) return e.join(' ' + a.rangeStr + ' ');
                  }
                  return a.isInput(s)
                    ? s.value
                    : 'static' === r.position
                    ? ''
                    : lay(s).attr('lay-date');
                })()),
              u = function(e) {
                e.year > y[1] && ((e.year = y[1]), (n = !0)),
                  e.month > 11 && ((e.month = 11), (n = !0)),
                  e.hours > 23 && ((e.hours = 0), (n = !0)),
                  e.minutes > 59 && ((e.minutes = 0), e.hours++, (n = !0)),
                  e.seconds > 59 && ((e.seconds = 0), e.minutes++, (n = !0)),
                  (t = i.getEndDate(e.month + 1, e.year)),
                  e.date > t && ((e.date = t), (n = !0));
              },
              d = function(e, t, i) {
                var o = ['startTime', 'endTime'];
                (t = (t.match(a.EXP_SPLIT) || []).slice(1)),
                  (i = i || 0),
                  r.range && (a[o[i]] = a[o[i]] || {}),
                  lay.each(a.format, function(l, s) {
                    var c = parseFloat(t[l]);
                    t[l].length < s.length && (n = !0),
                      /yyyy|y/.test(s)
                        ? (c < y[0] && ((c = y[0]), (n = !0)), (e.year = c))
                        : /MM|M/.test(s)
                        ? (c < 1 && ((c = 1), (n = !0)), (e.month = c - 1))
                        : /dd|d/.test(s)
                        ? (c < 1 && ((c = 1), (n = !0)), (e.date = c))
                        : /HH|H/.test(s)
                        ? (c < 1 && ((c = 0), (n = !0)),
                          (e.hours = c),
                          r.range && (a[o[i]].hours = c))
                        : /mm|m/.test(s)
                        ? (c < 1 && ((c = 0), (n = !0)),
                          (e.minutes = c),
                          r.range && (a[o[i]].minutes = c))
                        : /ss|s/.test(s) &&
                          (c < 1 && ((c = 0), (n = !0)),
                          (e.seconds = c),
                          r.range && (a[o[i]].seconds = c));
                  }),
                  u(e);
              };
            if ('limit' === e) return u(l), a;
            (c = c || r.value),
              'string' == typeof c &&
                (c = c.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''));
            var m = function() {
              r.range &&
                (a.endDate =
                  a.endDate ||
                  lay.extend(
                    {},
                    r.dateTime,
                    (function() {
                      var e = {},
                        t = r.dateTime,
                        n = a.getAsYM(t.year, t.month);
                      return (
                        'year' === r.type
                          ? (e.year = t.year + 1)
                          : 'time' !== r.type &&
                            ((e.year = n[0]), (e.month = n[1])),
                        ('datetime' !== r.type && 'time' !== r.type) ||
                          ((e.hours = 23), (e.minutes = e.seconds = 59)),
                        e
                      );
                    })(),
                  ));
            };
            m(),
              'string' == typeof c && c
                ? a.EXP_IF.test(c)
                  ? r.range
                    ? ((c = c.split(' ' + a.rangeStr + ' ')),
                      lay.each([r.dateTime, a.endDate], function(e, t) {
                        d(t, c[e], e);
                      }))
                    : d(l, c)
                  : (a.hint(
                      o.formatError[0] +
                        (r.range
                          ? r.format + ' ' + a.rangeStr + ' ' + r.format
                          : r.format) +
                        o.formatError[1],
                    ),
                    (n = !0))
                : c && c.constructor === Date
                ? (r.dateTime = a.systemDate(c))
                : ((r.dateTime = a.systemDate()),
                  delete a.startTime,
                  delete a.endDate,
                  m(),
                  delete a.endTime),
              (function() {
                if (a.rangeElem) {
                  var e = [a.rangeElem[0].val(), a.rangeElem[1].val()],
                    t = [r.dateTime, a.endDate];
                  lay.each(e, function(e, n) {
                    a.EXP_IF_ONE.test(n) && d(t[e], n, e);
                  });
                }
              })(),
              u(l),
              r.range && u(a.endDate),
              n &&
                c &&
                a.setValue(r.range ? (a.endDate ? a.parse() : '') : a.parse());
            var f = function(e) {
              return a.newDate(e).getTime();
            };
            return (
              (f(l) > f(r.max) || f(l) < f(r.min)) &&
                (l = r.dateTime = lay.extend({}, r.min)),
              r.range &&
                (f(a.endDate) < f(r.min) || f(a.endDate) > f(r.max)) &&
                (a.endDate = lay.extend({}, r.max)),
              e && e(),
              a
            );
          }),
          (w.prototype.mark = function(e, t) {
            var n,
              a = this,
              r = a.config;
            return (
              lay.each(r.mark, function(e, a) {
                var r = e.split('-');
                (r[0] != t[0] && 0 != r[0]) ||
                  (r[1] != t[1] && 0 != r[1]) ||
                  r[2] != t[2] ||
                  (n = a || t[2]);
              }),
              n && e.html('<span class="laydate-day-mark">' + n + '</span>'),
              a
            );
          }),
          (w.prototype.limit = function(e, t, n, a) {
            var r,
              i = this,
              o = i.config,
              l = {},
              s = o[n > 41 ? 'endDate' : 'dateTime'],
              c = lay.extend({}, s, t || {});
            return (
              lay.each({ now: c, min: o.min, max: o.max }, function(e, t) {
                l[e] = i
                  .newDate(
                    lay.extend(
                      { year: t.year, month: t.month, date: t.date },
                      (function() {
                        var e = {};
                        return (
                          lay.each(a, function(n, a) {
                            e[a] = t[a];
                          }),
                          e
                        );
                      })(),
                    ),
                  )
                  .getTime();
              }),
              (r = l.now < l.min || l.now > l.max),
              e && e[r ? 'addClass' : 'removeClass'](u),
              r
            );
          }),
          (w.prototype.thisDateTime = function(e) {
            var t = this,
              n = t.config;
            return e ? t.endDate : n.dateTime;
          }),
          (w.prototype.calendar = function(e, t, n) {
            var a,
              r,
              o,
              l = this,
              s = l.config,
              t = t ? 1 : 0,
              u = e || l.thisDateTime(t),
              d = new Date(),
              m = l.lang(),
              f = 'date' !== s.type && 'datetime' !== s.type,
              h = lay(l.table[t]).find('td'),
              g = lay(l.elemHeader[t][2]).find('span');
            return (
              u.year < y[0] && ((u.year = y[0]), l.hint(m.invalidDate)),
              u.year > y[1] && ((u.year = y[1]), l.hint(m.invalidDate)),
              l.firstDate || (l.firstDate = lay.extend({}, u)),
              d.setFullYear(u.year, u.month, 1),
              (a = d.getDay()),
              (r = i.getEndDate(u.month || 12, u.year)),
              (o = i.getEndDate(u.month + 1, u.year)),
              lay.each(h, function(e, t) {
                var n = [u.year, u.month],
                  i = 0;
                (t = lay(t)),
                  t.removeAttr('class'),
                  e < a
                    ? ((i = r - a + e),
                      t.addClass('laydate-day-prev'),
                      (n = l.getAsYM(u.year, u.month, 'sub')))
                    : e >= a && e < o + a
                    ? ((i = e - a), i + 1 === u.date && t.addClass(c))
                    : ((i = e - o - a),
                      t.addClass('laydate-day-next'),
                      (n = l.getAsYM(u.year, u.month))),
                  n[1]++,
                  (n[2] = i + 1),
                  t.attr('lay-ymd', n.join('-')).html(n[2]),
                  l
                    .mark(t, n)
                    .limit(t, { year: n[0], month: n[1] - 1, date: n[2] }, e);
              }),
              lay(g[0]).attr('lay-ym', u.year + '-' + (u.month + 1)),
              lay(g[1]).attr('lay-ym', u.year + '-' + (u.month + 1)),
              'cn' === s.lang
                ? (lay(g[0])
                    .attr('lay-type', 'year')
                    .html(u.year + ' \u5e74'),
                  lay(g[1])
                    .attr('lay-type', 'month')
                    .html(u.month + 1 + ' \u6708'))
                : (lay(g[0])
                    .attr('lay-type', 'month')
                    .html(m.month[u.month]),
                  lay(g[1])
                    .attr('lay-type', 'year')
                    .html(u.year)),
              f &&
                (s.range
                  ? e &&
                    ((l.listYM = [
                      [s.dateTime.year, s.dateTime.month + 1],
                      [l.endDate.year, l.endDate.month + 1],
                    ]),
                    l.list(s.type, 0).list(s.type, 1),
                    'time' === s.type
                      ? l.setBtnStatus(
                          '\u65f6\u95f4',
                          lay.extend({}, l.systemDate(), l.startTime),
                          lay.extend({}, l.systemDate(), l.endTime),
                        )
                      : l.setBtnStatus(!0))
                  : ((l.listYM = [[u.year, u.month + 1]]), l.list(s.type, 0))),
              s.range && 'init' === n && !e && l.calendar(l.endDate, 1),
              s.range ||
                l.limit(lay(l.footer).find(p), null, 0, [
                  'hours',
                  'minutes',
                  'seconds',
                ]),
              l.setBtnStatus(),
              l
            );
          }),
          (w.prototype.list = function(e, t) {
            var n = this,
              a = n.config,
              r = a.dateTime,
              i = n.lang(),
              o = a.range && 'date' !== a.type && 'datetime' !== a.type,
              l = lay.elem('ul', {
                class:
                  m +
                  ' ' +
                  {
                    year: 'laydate-year-list',
                    month: 'laydate-month-list',
                    time: 'laydate-time-list',
                  }[e],
              }),
              s = n.elemHeader[t],
              y = lay(s[2]).find('span'),
              d = n.elemCont[t || 0],
              f = lay(d).find('.' + m)[0],
              h = 'cn' === a.lang,
              T = h ? '\u5e74' : '',
              w = n.listYM[t] || {},
              D = ['hours', 'minutes', 'seconds'],
              b = ['startTime', 'endTime'][t];
            if ((w[0] < 1 && (w[0] = 1), 'year' === e)) {
              var E,
                x = (E = w[0] - 7);
              x < 1 && (x = E = 1),
                lay.each(new Array(15), function(e) {
                  var r = lay.elem('li', { 'lay-ym': E }),
                    i = { year: E };
                  E == w[0] && lay(r).addClass(c),
                    (r.innerHTML = E + T),
                    l.appendChild(r),
                    E < n.firstDate.year
                      ? ((i.month = a.min.month), (i.date = a.min.date))
                      : E >= n.firstDate.year &&
                        ((i.month = a.max.month), (i.date = a.max.date)),
                    n.limit(lay(r), i, t),
                    E++;
                }),
                lay(y[h ? 0 : 1])
                  .attr('lay-ym', E - 8 + '-' + w[1])
                  .html(x + T + ' - ' + (E - 1 + T));
            } else if ('month' === e)
              lay.each(new Array(12), function(e) {
                var r = lay.elem('li', { 'lay-ym': e }),
                  o = { year: w[0], month: e };
                e + 1 == w[1] && lay(r).addClass(c),
                  (r.innerHTML = i.month[e] + (h ? '\u6708' : '')),
                  l.appendChild(r),
                  w[0] < n.firstDate.year
                    ? (o.date = a.min.date)
                    : w[0] >= n.firstDate.year && (o.date = a.max.date),
                  n.limit(lay(r), o, t);
              }),
                lay(y[h ? 0 : 1])
                  .attr('lay-ym', w[0] + '-' + w[1])
                  .html(w[0] + T);
            else if ('time' === e) {
              var C = function() {
                lay(l)
                  .find('ol')
                  .each(function(e, a) {
                    lay(a)
                      .find('li')
                      .each(function(a, r) {
                        n.limit(
                          lay(r),
                          [
                            { hours: a },
                            { hours: n[b].hours, minutes: a },
                            {
                              hours: n[b].hours,
                              minutes: n[b].minutes,
                              seconds: a,
                            },
                          ][e],
                          t,
                          [
                            ['hours'],
                            ['hours', 'minutes'],
                            ['hours', 'minutes', 'seconds'],
                          ][e],
                        );
                      });
                  }),
                  a.range ||
                    n.limit(lay(n.footer).find(p), n[b], 0, [
                      'hours',
                      'minutes',
                      'seconds',
                    ]);
              };
              a.range
                ? n[b] || (n[b] = 'startTime' === b ? r : n.endDate)
                : (n[b] = r),
                lay.each([24, 60, 60], function(e, t) {
                  var a = lay.elem('li'),
                    r = ['<p>' + i.time[e] + '</p><ol>'];
                  lay.each(new Array(t), function(t) {
                    r.push(
                      '<li' +
                        (n[b][D[e]] === t ? ' class="' + c + '"' : '') +
                        '>' +
                        lay.digit(t, 2) +
                        '</li>',
                    );
                  }),
                    (a.innerHTML = r.join('') + '</ol>'),
                    l.appendChild(a);
                }),
                C();
            }
            if (
              (f && d.removeChild(f),
              d.appendChild(l),
              'year' === e || 'month' === e)
            )
              lay(n.elemMain[t]).addClass('laydate-ym-show'),
                lay(l)
                  .find('li')
                  .on('click', function() {
                    var i = 0 | lay(this).attr('lay-ym');
                    if (!lay(this).hasClass(u)) {
                      0 === t
                        ? ((r[e] = i), n.limit(lay(n.footer).find(p), null, 0))
                        : (n.endDate[e] = i);
                      var s = 'year' === a.type || 'month' === a.type;
                      s
                        ? (lay(l)
                            .find('.' + c)
                            .removeClass(c),
                          lay(this).addClass(c),
                          'month' === a.type &&
                            'year' === e &&
                            ((n.listYM[t][0] = i),
                            o && ((t ? n.endDate : r).year = i),
                            n.list('month', t)))
                        : (n.checkDate('limit').calendar(null, t),
                          n.closeList()),
                        n.setBtnStatus(),
                        a.range ||
                          ((('month' === a.type && 'month' === e) ||
                            ('year' === a.type && 'year' === e)) &&
                            n
                              .setValue(n.parse())
                              .remove()
                              .done()),
                        n.done(null, 'change'),
                        lay(n.footer)
                          .find('.' + v)
                          .removeClass(u);
                    }
                  });
            else {
              var M = lay.elem('span', { class: g }),
                S = function() {
                  lay(l)
                    .find('ol')
                    .each(function(e) {
                      var t = this,
                        a = lay(t).find('li');
                      (t.scrollTop = 30 * (n[b][D[e]] - 2)),
                        t.scrollTop <= 0 &&
                          a.each(function(e, n) {
                            if (!lay(this).hasClass(u))
                              return (t.scrollTop = 30 * (e - 2)), !0;
                          });
                    });
                },
                k = lay(s[2]).find('.' + g);
              S(),
                (M.innerHTML = a.range
                  ? [i.startTime, i.endTime][t]
                  : i.timeTips),
                lay(n.elemMain[t]).addClass('laydate-time-show'),
                k[0] && k.remove(),
                s[2].appendChild(M),
                lay(l)
                  .find('ol')
                  .each(function(e) {
                    var t = this;
                    lay(t)
                      .find('li')
                      .on('click', function() {
                        var i = 0 | this.innerHTML;
                        lay(this).hasClass(u) ||
                          (a.range ? (n[b][D[e]] = i) : (r[D[e]] = i),
                          lay(t)
                            .find('.' + c)
                            .removeClass(c),
                          lay(this).addClass(c),
                          C(),
                          S(),
                          (n.endDate || 'time' === a.type) &&
                            n.done(null, 'change'),
                          n.setBtnStatus());
                      });
                  });
            }
            return n;
          }),
          (w.prototype.listYM = []),
          (w.prototype.closeList = function() {
            var e = this;
            e.config;
            lay.each(e.elemCont, function(t, n) {
              lay(this)
                .find('.' + m)
                .remove(),
                lay(e.elemMain[t]).removeClass(
                  'laydate-ym-show laydate-time-show',
                );
            }),
              lay(e.elem)
                .find('.' + g)
                .remove();
          }),
          (w.prototype.setBtnStatus = function(e, t, n) {
            var a,
              r = this,
              i = r.config,
              o = r.lang(),
              l = lay(r.footer).find(p);
            i.range &&
              'time' !== i.type &&
              ((t = t || i.dateTime),
              (n = n || r.endDate),
              (a = r.newDate(t).getTime() > r.newDate(n).getTime()),
              r.limit(null, t) || r.limit(null, n)
                ? l.addClass(u)
                : l[a ? 'addClass' : 'removeClass'](u),
              e &&
                a &&
                r.hint(
                  'string' == typeof e
                    ? o.timeout.replace(/\u65e5\u671f/g, e)
                    : o.timeout,
                ));
          }),
          (w.prototype.parse = function(e, t) {
            var n = this,
              a = n.config,
              r =
                t ||
                ('end' == e
                  ? lay.extend({}, n.endDate, n.endTime)
                  : a.range
                  ? lay.extend({}, a.dateTime, n.startTime)
                  : a.dateTime),
              o = i.parse(r, n.format, 1);
            return a.range && void 0 === e
              ? o + ' ' + n.rangeStr + ' ' + n.parse('end')
              : o;
          }),
          (w.prototype.newDate = function(e) {
            return (
              (e = e || {}),
              new Date(
                e.year || 1,
                e.month || 0,
                e.date || 1,
                e.hours || 0,
                e.minutes || 0,
                e.seconds || 0,
              )
            );
          }),
          (w.prototype.setValue = function(e) {
            var t = this,
              n = t.config,
              a = t.bindElem || n.elem[0];
            return 'static' === n.position
              ? t
              : ((e = e || ''),
                t.isInput(a)
                  ? lay(a).val(e)
                  : t.rangeElem
                  ? (t.rangeElem[0].val(e ? t.parse('start') : ''),
                    t.rangeElem[1].val(e ? t.parse('end') : ''))
                  : (0 === lay(a).find('*').length && lay(a).html(e),
                    lay(a).attr('lay-date', e)),
                t);
          }),
          (w.prototype.preview = function() {
            var e = this,
              t = e.config;
            if (t.isPreview) {
              var n = lay(e.elem).find('.' + T),
                a = t.range ? (e.endDate ? e.parse() : '') : e.parse();
              n.html(a).css({ color: '#5FB878', 'font-size': '14px;' }),
                setTimeout(function() {
                  n.css({ color: '#666', 'font-size': '12px;' });
                }, 300);
            }
          }),
          (w.prototype.done = function(e, t) {
            var n = this,
              a = n.config,
              r = lay.extend({}, lay.extend(a.dateTime, n.startTime)),
              i = lay.extend({}, lay.extend(n.endDate, n.endTime));
            return (
              lay.each([r, i], function(e, t) {
                'month' in t && lay.extend(t, { month: t.month + 1 });
              }),
              n.preview(),
              (e = e || [n.parse(), r, i]),
              'function' == typeof a[t || 'done'] && a[t || 'done'].apply(a, e),
              n
            );
          }),
          (w.prototype.choose = function(e, t) {
            var n = this,
              a = n.config,
              r = n.thisDateTime(t),
              i = (lay(n.elem).find('td'), e.attr('lay-ymd').split('-'));
            (i = { year: 0 | i[0], month: (0 | i[1]) - 1, date: 0 | i[2] }),
              e.hasClass(u) ||
                (lay.extend(r, i),
                a.range
                  ? (lay.each(['startTime', 'endTime'], function(e, t) {
                      n[t] = n[t] || { hours: 0, minutes: 0, seconds: 0 };
                    }),
                    n.calendar(null, t).done(null, 'change'))
                  : 'static' === a.position
                  ? n
                      .calendar()
                      .done()
                      .done(null, 'change')
                  : 'date' === a.type
                  ? n
                      .setValue(n.parse())
                      .remove()
                      .done()
                  : 'datetime' === a.type && n.calendar().done(null, 'change'));
          }),
          (w.prototype.tool = function(e, t) {
            var n = this,
              a = n.config,
              r = n.lang(),
              i = a.dateTime,
              o = 'static' === a.position,
              l = {
                datetime: function() {
                  lay(e).hasClass(u) ||
                    (n.list('time', 0),
                    a.range && n.list('time', 1),
                    lay(e)
                      .attr('lay-type', 'date')
                      .html(n.lang().dateTips));
                },
                date: function() {
                  n.closeList(),
                    lay(e)
                      .attr('lay-type', 'datetime')
                      .html(n.lang().timeTips);
                },
                clear: function() {
                  o && (lay.extend(i, n.firstDate), n.calendar()),
                    a.range &&
                      (delete a.dateTime,
                      delete n.endDate,
                      delete n.startTime,
                      delete n.endTime),
                    n.setValue('').remove(),
                    n.done(['', {}, {}]);
                },
                now: function() {
                  var e = new Date();
                  lay.extend(i, n.systemDate(), {
                    hours: e.getHours(),
                    minutes: e.getMinutes(),
                    seconds: e.getSeconds(),
                  }),
                    n.setValue(n.parse()).remove(),
                    o && n.calendar(),
                    n.done();
                },
                confirm: function() {
                  if (a.range) {
                    if (lay(e).hasClass(u))
                      return n.hint(
                        'time' === a.type
                          ? r.timeout.replace(/\u65e5\u671f/g, '\u65f6\u95f4')
                          : r.timeout,
                      );
                  } else if (lay(e).hasClass(u)) return n.hint(r.invalidDate);
                  n.done(), n.setValue(n.parse()).remove();
                },
              };
            l[t] && l[t]();
          }),
          (w.prototype.change = function(e) {
            var t = this,
              n = t.config,
              a = t.thisDateTime(e),
              r = n.range && ('year' === n.type || 'month' === n.type),
              i = t.elemCont[e || 0],
              o = t.listYM[e],
              l = function(l) {
                var s = lay(i).find('.laydate-year-list')[0],
                  c = lay(i).find('.laydate-month-list')[0];
                return (
                  s && ((o[0] = l ? o[0] - 15 : o[0] + 15), t.list('year', e)),
                  c && (l ? o[0]-- : o[0]++, t.list('month', e)),
                  (s || c) &&
                    (lay.extend(a, { year: o[0] }),
                    r && (a.year = o[0]),
                    n.range || t.done(null, 'change'),
                    n.range || t.limit(lay(t.footer).find(p), { year: o[0] })),
                  t.setBtnStatus(),
                  s || c
                );
              };
            return {
              prevYear: function() {
                l('sub') ||
                  (a.year--,
                  t.checkDate('limit').calendar(null, e),
                  t.done(null, 'change'));
              },
              prevMonth: function() {
                var n = t.getAsYM(a.year, a.month, 'sub');
                lay.extend(a, { year: n[0], month: n[1] }),
                  t.checkDate('limit').calendar(null, e),
                  t.done(null, 'change');
              },
              nextMonth: function() {
                var n = t.getAsYM(a.year, a.month);
                lay.extend(a, { year: n[0], month: n[1] }),
                  t.checkDate('limit').calendar(null, e),
                  t.done(null, 'change');
              },
              nextYear: function() {
                l() ||
                  (a.year++,
                  t.checkDate('limit').calendar(null, e),
                  t.done(null, 'change'));
              },
            };
          }),
          (w.prototype.changeEvent = function() {
            var e = this;
            e.config;
            lay(e.elem)
              .on('click', function(e) {
                lay.stope(e);
              })
              .on('mousedown', function(e) {
                lay.stope(e);
              }),
              lay.each(e.elemHeader, function(t, n) {
                lay(n[0]).on('click', function(n) {
                  e.change(t).prevYear();
                }),
                  lay(n[1]).on('click', function(n) {
                    e.change(t).prevMonth();
                  }),
                  lay(n[2])
                    .find('span')
                    .on('click', function(n) {
                      var a = lay(this),
                        r = a.attr('lay-ym'),
                        i = a.attr('lay-type');
                      r &&
                        ((r = r.split('-')),
                        (e.listYM[t] = [0 | r[0], 0 | r[1]]),
                        e.list(i, t),
                        lay(e.footer)
                          .find('.' + v)
                          .addClass(u));
                    }),
                  lay(n[3]).on('click', function(n) {
                    e.change(t).nextMonth();
                  }),
                  lay(n[4]).on('click', function(n) {
                    e.change(t).nextYear();
                  });
              }),
              lay.each(e.table, function(t, n) {
                var a = lay(n).find('td');
                a.on('click', function() {
                  e.choose(lay(this), t);
                });
              }),
              lay(e.footer)
                .find('span')
                .on('click', function() {
                  var t = lay(this).attr('lay-type');
                  e.tool(this, t);
                });
          }),
          (w.prototype.isInput = function(e) {
            return /input|textarea/.test(e.tagName.toLocaleLowerCase());
          }),
          (w.prototype.events = function() {
            var e = this,
              t = e.config,
              n = function(n, a) {
                n.on(t.trigger, function() {
                  a && (e.bindElem = this), e.render();
                });
              };
            t.elem[0] &&
              !t.elem[0].eventHandler &&
              (n(t.elem, 'bind'),
              n(t.eventElem),
              (t.elem[0].eventHandler = !0));
          }),
          (o.that = {}),
          (o.getThis = function(e) {
            var t = o.that[e];
            return (
              t ||
                hint.error(
                  e
                    ? l + " instance with ID '" + e + "' not found"
                    : 'ID argument required',
                ),
              t
            );
          }),
          (a.run = function(n) {
            n(t)
              .on('mousedown', function(e) {
                if (i.thisId) {
                  var t = o.getThis(i.thisId);
                  if (t) {
                    var a = t.config;
                    e.target !== a.elem[0] &&
                      e.target !== a.eventElem[0] &&
                      e.target !== n(a.closeStop)[0] &&
                      t.remove();
                  }
                }
              })
              .on('keydown', function(e) {
                if (i.thisId) {
                  var t = o.getThis(i.thisId);
                  t &&
                    13 === e.keyCode &&
                    n('#' + t.elemID)[0] &&
                    t.elemID === w.thisElemDate &&
                    (e.preventDefault(),
                    n(t.footer)
                      .find(p)[0]
                      .click());
                }
              }),
              n(e).on('resize', function() {
                if (i.thisId) {
                  var e = o.getThis(i.thisId);
                  if (e) return !(!e.elem || !n(s)[0]) && void e.position();
                }
              });
          }),
          (i.render = function(e) {
            var t = new w(e);
            return o.call(t);
          }),
          (i.parse = function(e, t, n) {
            return (
              (e = e || {}),
              'string' == typeof t && (t = o.formatArr(t)),
              (t = (t || []).concat()),
              lay.each(t, function(a, r) {
                /yyyy|y/.test(r)
                  ? (t[a] = lay.digit(e.year, r.length))
                  : /MM|M/.test(r)
                  ? (t[a] = lay.digit(e.month + (n || 0), r.length))
                  : /dd|d/.test(r)
                  ? (t[a] = lay.digit(e.date, r.length))
                  : /HH|H/.test(r)
                  ? (t[a] = lay.digit(e.hours, r.length))
                  : /mm|m/.test(r)
                  ? (t[a] = lay.digit(e.minutes, r.length))
                  : /ss|s/.test(r) && (t[a] = lay.digit(e.seconds, r.length));
              }),
              t.join('')
            );
          }),
          (i.getEndDate = function(e, t) {
            var n = new Date();
            return (
              n.setFullYear(t || n.getFullYear(), e || n.getMonth() + 1, 1),
              new Date(n.getTime() - 864e5).getDate()
            );
          }),
          n
            ? (i.ready(),
              layui.define('lay', function(e) {
                (i.path = layui.cache.dir), a.run(lay), e(l, i);
              }))
            : 'function' == typeof define && define.amd
            ? define(function() {
                return a.run(lay), i;
              })
            : (function() {
                i.ready(), a.run(e.lay), (e.laydate = i);
              })();
      })(window, window.document);
    //执行一个laydate实例
    window.setImmediate(function() {
      laydate.render({
        elem: '.start_time', //指定元素
        btns: ['confirm'],
      });
      laydate.render({
        elem: '.end_time', //指定元素
        btns: ['confirm'],
      });
    }, 0);
    let pageTotal = this.totalPage.get();
    let _this = this;
    $('#pagination1').pagination({
      currentPage: 1,
      totalPage: pageTotal,
      callback: function(current) {
        _this.pageNo = parseInt(current);
        _this.dataArray = _this.weekUsersInfo();
        _this.dataArr.set(_this.dataArray);
      },
    });

    // $(".ui-pagination-page-item").click(function(e){
    //   // e.preventDefault();
    //   console.log($(this).attr("data-current"));
    //   //this.startTime = new Date(document.querySelector("#startDate").value.split("/").join("-"))
    //   //this.endTime =  new Date(document.querySelector("#endDate").value.split("/").join("-"))
    //   _this.pageNo = parseInt($(this).attr("data-current"));
    //   _this.dataArray = _this.weekUsersInfo();
    //   _this.dataArr.set(_this.dataArray);
    // })
    // const currentBoard = Boards.findOne(Session.get('currentBoard'));
    // const boardId = Session.get('currentBoard');
    // this.cardList = [];
    // Cards.find({ boardId }).forEach(card => {
    //   cardList.push(card);
    // });
    //周报列拖动
    //允许放入
    // $('.s-tab2 tr>th').on('dragover', function(e) {
    //   e.originalEvent.preventDefault();
    //   // e.preventDefault();
    //   //console.log('拿起');
    // });
    // $('.s-tab2 tr>th').ondragenter = function(e) {
    //   e.originalEvent.preventDefault();
    //   //console.log('sasas');
    // };
    // // $(".s-tab2 tr>th").click(function(){
    // //   $(this).html("zep");
    // // }
    // // )
    // // 拿起
    // $('.s-tab2 tr>th').on('dragstart', function(e) {
    //   //e.originalEvent.preventDefault();
    //   // e.stopPropagation();
    //   //e.preventDefault();
    //   //console.log(1111);
    //   e.originalEvent.dataTransfer.setData(
    //     'obj_add',
    //     e.currentTarget.cellIndex,
    //   );
    //   // console.log('拿起1');
    //   // console.log(e.currentTarget.cellIndex);
    // });
    // //放下
    // $('.s-tab2 tr>th').on('drop', function(e) {
    //   //e.stopPropagation();
    //   //e.preventDefault();
    //   e.originalEvent.preventDefault();
    //   var q = parseInt(e.originalEvent.dataTransfer.getData('obj_add')); //所拿起的th列下标
    //   // console.log(i);
    //   var d = this.cellIndex; //被放入的列下标
    //   // console.log(d);
    //   // var _t = this;
    //   //console.log(_t);
    //   // $('.s-tab2 tr>th').each(function() {
    //   //   //debugger;
    //   //   var j = this;
    //   //   //console.log(j);
    //   //   cosnole.log(j.cellIndex);
    //   //   if (j.cellIndex == i) {
    //   //     _t.before(j);
    //   //     return false;
    //   //   }
    //   // });
    //   $('.s-tab2 tbody>tr').each(function() {
    //     var drag = ''; //拿起的td
    //     var drop = ''; //放下的td
    //     $(this)
    //       .children()
    //       .each(function() {
    //         if (this.cellIndex == q) {
    //           drag = this;
    //           //
    //           q1 = this.dataset.key
    //           console.log(q1);
    //           console.log(drag);
    //         }
    //         if (this.cellIndex == d) {
    //           drop = this;
    //           d1 = this.dataset.key
    //           console.log(d1);
    //           console.log(drop);
    //         }
    //       });
    //     if (
    //       drag != undefined &&
    //       drop != undefined &&
    //       drag != '' &&
    //       drop != '' &&
    //       q > d
    //     ) {
    //       drop.before(drag);
    //     } else {
    //       drag.before(drop);
    //     }
    //   });
    // });
    document.querySelectorAll('.s-tab-index')[0].click();
    $('#modal-content').draggable();
    document.getElementById('modal').style.overflow = 'hidden';
    const self = this;
    document.getElementsByClassName('modal-content')[0].addEventListener(
      'click',
      function() {
        self.setSetColumnViewShow(false);
        document.getElementsByClassName(
          'js-set-coclumn',
        )[0].style.backgroundColor = '#fff';
        self.setSetStaffViewShow(false);
        document.getElementsByClassName(
          'js-set-staff',
        )[0].style.backgroundColor = '#fff';
      },
      true,
    );
    Tracker.autorun(function() {});
  },
  getSvg() {
    let query = {
      fromDate: this.startTime,
      toDate: this.endTime,
      pageNo: this.pageNo,
      pagesize: this.pageSize,
    };
    // console.log(query);
    // console.log(this.getWeeklyReports(query));
    let data = this.getWeeklyReports(query).get();
  //   let arr =[];
  //   let arr1 =[];
  //   data.forEach((ele,index)=>{
  //     if(ele.cardAssignees.length===0){
  //       arr.push(ele);
  //     }
  //     else{
  //       arr1.push(ele);
  //     }
  //   })
  //   let arr2=[];
  //   for(let i=0;i<arr1.length;i++){
  //     arr2.push(arr1[i]);
  //     for(let j=i+1;j<arr1.length;j++){
  //       if(arr1[i].cardAssignees[0].userId === arr1[j].cardAssignees[0].userId){
  //         // console.log(arr1[i].assignees[0].userId);
  //         // console.log(arr1[j].assignees[0].userId);
  //         arr2.push(arr1[j]);
  //         arr1.splice(j,1);
  //         j--
  //       }
  //     }
  //  }
  //   data= arr2.concat(arr);
    //console.log(data);
    data.forEach((item, index) => {
      let html = '';
      item.cardMembers.forEach((item, index) => {
        html += this.getIndexUserAvatar(item.userId);
      });
      document
        .querySelector('.s-tab2')
        .querySelectorAll('.s-tb-tr')
        [index].querySelectorAll('td')[1].innerHTML = html;
    });
    data.forEach((item, index) => {
      let html = '';
      item.cardAssignees.forEach((item, index) => {
        html += this.getIndexUserAvatar(item.userId);
      });
      document
        .querySelector('.s-tab2')
        .querySelectorAll('.s-tb-tr')
        [index].querySelectorAll('td')[0].innerHTML = html;
    });
  },
  data() {
    return this.dataArr.get();
  },
  //加载周报后默认的时间是本周的时间
  time() {
    const curDate = new Date();
    let timeArray = [];
    let obj = {};
    let startTime = new Date(
      curDate.getTime() - (curDate.getDay() - 1) * 24 * 60 * 60 * 1000,
    ).toLocaleDateString();
    let startArray = startTime.split('/');
    if (parseInt(startArray[1]) < 10) {
      startArray[1] = 0 + startArray[1];
    }
    if (parseInt(startArray[2]) < 10) {
      startArray[2] = 0 + startArray[2];
    }
    obj.startTime = startArray.join('-');
    let endTime = new Date(
      curDate.getTime() + (7 - curDate.getDay()) * 24 * 60 * 60 * 1000,
    ).toLocaleDateString();
    let endArray = endTime.split('/');
    if (parseInt(endArray[1]) < 10) {
      endArray[1] = 0 + endArray[1];
    }
    if (parseInt(endArray[2]) < 10) {
      endArray[2] = 0 + endArray[2];
    }
    obj.endTime = endArray.join('-');
    timeArray.push(obj);
    return timeArray;
  },
  // startTime(){
  //   const curDate = new Date();
  //   this.startTime=new Date(curDate.getTime()-(curDate.getDay()*24*60*60*1000)).toLocaleDateString();
  //   console.log(this.startTime);
  //   return this.startTime;
  // },
  // endTime(){
  //   const curDate = new Date();
  //   this.endTime=new Date(curDate.getTime() - ((7-curDate.getDay())*24*60*60*1000)).toLocaleDateString();
  //   return this.endTime
  // },
  getIndexStaffsPercent() {},

  indexThCount(thTitle) {
    // console.log('-----indexThCount----', thTitle);
    let num = 0;
    const indexBoardUserArr = this.indexBoardUserArr.get();
    if (thTitle === '被指派人') {
      num = indexBoardUserArr.length;
    } else {
      for (let i = 0; i < indexBoardUserArr.length; i++) {
        const element = indexBoardUserArr[i];
        num += element[thTitle];
      }
    }

    return num;
  },
  setIndexTitle(item) {
    // console.log('------setIndexTitle----', item);
    this.indexTitle = item;
  },
  getIndexTdValIndex(indexUserTasks) {
    //  console.log('----each value---item----', indexUserTasks, this
    //    .indexTitle);
    //---------------------modified by lvbing--------------------------
    let titleArr;
    const tab0 = !!document
      .querySelectorAll('.s-tab-index')[0]
      .classList.contains('active');
    //人员统计
    if (!tab0) titleArr = this.titleArrV.get();
    //标签统计
    else titleArr = this.titleArrV1.get();
    //const titleArr = this.titleArrV.get()
    if (titleArr.indexOf(this.indexTitle) === 0) {
      return indexUserTasks.userName;
    } else {
      return indexUserTasks[this.indexTitle];
    }
  },
  getIndexUserAvatar(userId) {
    // console.log('-----getIndexUserAvatar------', Blaze.toHTMLWithData(Template.userAvatar, {
    //   userId: userId,
    // }))
    return  this.isMobileDevice()?'':Blaze.toHTMLWithData(Template.userAvatar, {
      userId,
    });
  },
  getIndexTdValIndex1(indexUserTasks) {
    // console.log('-----------getIndexTdValIndex1--------', '');
    setTimeout(() => {
      let index = -1;
      for (let i = 0; i < this.memberTasks.length; i++) {
        const element = this.memberTasks[i];
        if (indexUserTasks.userId === element.userId) {
          index = i;
          break;
        }
      }
      //---------------------modified by lvbing--------------------------
      let titleArr;
      const tab0 = !!document
        .querySelectorAll('.s-tab-index')[0]
        .classList.contains('active');
      //人员统计
      if (!tab0) titleArr = this.titleArrV.get();
      //标签统计
      else titleArr = this.titleArrV1.get();
      //const titleArr = this.titleArrV.get();
      const indexTr = document.getElementsByClassName('s-tb-tr')[index];
      indexTr.innerHTML = '';
      for (let i = 0; i < titleArr.length; i++) {
        const thT = titleArr[i];

        // console.log('----each value----thT---', indexUserTasks, thT);

        const trTd = document.createElement('td');
        if (titleArr[i] === '被指派人') {
          trTd.innerHTML = `${
            indexUserTasks.userId === 'noAssigneeId'
              ? ''
              : this.getIndexUserAvatar(indexUserTasks.userId)
          }<span>${indexUserTasks.userName}</span>`;
          // trTd.appendChild() = ;
        } else {
          trTd.innerHTML = indexUserTasks[titleArr[i]];
        }
        if (indexUserTasks.userName === '无被指派人') {
          indexTr.style.opacity = 0.6;
          indexTr.style.color = 'red';
        } else {
          indexTr.style.opacity = 1;
          indexTr.style.color = '#000';
        }
        indexTr.appendChild(trTd);
      }
      //---------------------modified by lvbing--------------------------
      let popMenuToggleArr;
      //人员统计
      if (!tab0) popMenuToggleArr = this.popMenuToggleArrV.get();
      //标签统计
      else popMenuToggleArr = this.popMenuToggleArrV1.get();
      //  const popMenuToggleArr = this.popMenuToggleArrV.get();
      const sTbSrD = document.getElementsByClassName('s-tb-tr');
      // console.log('=====popMenuToggleArr=checkl==0000===',
      //   popMenuToggleArr);

      for (let i = 0; i < popMenuToggleArr.length; i++) {
        const element = popMenuToggleArr[i];
        // console.log('=====popMenuToggleArr=checkl=====', element);

        if (!element.checked) {
          for (let j = 0; j < sTbSrD.length; j++) {
            const sTbSrDIndex = sTbSrD[j];
            // console.log('=====sTbSrDIndex======', sTbSrDIndex.children[
            // i + 1]);
            sTbSrDIndex.children[i + 1].style.display = 'none';
          }
        }
      }
    }, 0);

    // return indexTr;
  },
  //周报数据列表的展示
  getIndexTdValIndex2(indexUserTasks) {
    //console.log(index);
    // for (let i = 0; i <indexUserTasks.length; i++) {
    //   const indexTr = document.getElementsByClassName('s-tb-tr')[i];
    //     for(let j = 0; j <this.weekArr.length;j++){
    //     const trTd = document.createElement('td');
    //     if(indexUserTasks[j].assignees.length!==0){
    //       indexUserTasks[j].assignees.forEach(function(ele,index){
    //         sds
    //       })
    //     }
    //     trTd.innerHTML="";
    //     indexTr.appendChild(trTd);
    //   }
    // }
  },
  isMobileDevice() {
    const sUserAgent = navigator.userAgent.toLowerCase();
    const bIsIpad = sUserAgent.match(/ipad/i) === 'ipad';
    const bIsIphoneOs = sUserAgent.match(/iphone os/i) === 'iphone os';
    const bIsMidp = sUserAgent.match(/midp/i) === 'midp';
    const bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) === 'rv:1.2.3.4';
    const bIsUc = sUserAgent.match(/ucweb/i) === 'ucweb';
    const bIsAndroid = sUserAgent.match(/android/i) === 'android';
    const bIsCE = sUserAgent.match(/windows ce/i) === 'windows ce';
    const bIsWM = sUserAgent.match(/windows mobile/i) === 'windows mobile';
    if (
      !(
        bIsIpad ||
        bIsIphoneOs ||
        bIsMidp ||
        bIsUc7 ||
        bIsUc ||
        bIsAndroid ||
        bIsCE ||
        bIsWM
      )
    ) {
      return false;
    } else {
      return true;
    }
  },

  getAssigneesList(boardId) {
    const lists = [];
    Lists.find(
      {
        boardId,
      },
      {
        sort: {
          sort: 1 /* boards default sorting */,
        },
      },
    ).forEach((item, index) => {
      lists.push(item);
      this.listsTitleArr[index] = item.title;
      //-----------------modified by lvbing------------------------------------
      this.listsIdArr[index] = item._id;
      this.memberTasks.forEach((item1, index1) => {
        item1[item.title] = 0;
      });
    });
    // console.log('------lists ------', lists);
    for (let i = 0; i < lists.length; i++) {
      const indexListCards = [];
      const list = lists[i];
      const indexT = list.title;
      Cards.find({
        listId: list._id,
      }).forEach((item, index) => {
        indexListCards.push(item);
      });

      for (let j = 0; j < indexListCards.length; j++) {
        const indexListCardsIndexCard = indexListCards[j];
        //  const members = indexListCardsIndexCard.members;
        const members = indexListCardsIndexCard.assignees;
        //当前卡片是否有被指派人
        let isCardAssigneed = false;
        for (let k = 0; k < this.memberTasks.length; k++) {
          const memberTask = this.memberTasks[k];
          if (members.indexOf(memberTask.userId) !== -1) {
            memberTask[indexT]++;
            isCardAssigneed = true;
          }
        }
        //若是无被指派人
        if (!isCardAssigneed) {
          for (let s = 0; s < this.memberTasks.length; s++) {
            if (this.memberTasks[s].userName === '无被指派人') {
              this.memberTasks[s][indexT]++;
            }
          }
        }
        isCardAssigneed = false;
      }
    }
    // console.log('-----listsTitleArr-----', this.listsTitleArr);

    // console.log('-----this.memberTasks-----', this.memberTasks);
  },
  getMyCards(userId, listTitle) {
    // console.log('-----userId-----', userId)
    const myCards = [];
    const cards = [];
    Cards.find(
      {
        // archived: false,
        // $or: [{ members: userId }, { assignees: userId }],
        $or: [
          {
            members: userId,
          },
        ],
      },
      // {
      // fields: {
      //   _id: 1,
      //   archived: 1,
      //   boardId: 1,
      //   swimlaneId: 1,
      //   listId: 1,
      //   title: 1,
      //   type: 1,
      //   sort: 1,
      //   members: 1,
      //   assignees: 1,
      //   colors: 1,
      //   dueAt: 1,
      // },
      //  sort: {
      //    sort: ['boardId', 'listId', 'sort'],
      //  },
      // },
    ).forEach(card => {
      cards.push(card);
    });
    if (!cards) return {};
    // console.log('-----cards------', cards);

    cards.forEach(card => {
      const list = Lists.findOne(card.listId);
      // console.log('-----list------', list);

      if (list && listTitle === list.title) {
        myCards.push(card);
      }
    });
    // console.log('------myCards-------', myCards);

    return myCards;
  },
  initBarChart() {
    const labelsBar = document.getElementById('labelsBar');
    const labelBarChart = echarts.init(labelsBar, 'macarons');
    const temData = this.seriesUserData.sort(function(a, b) {
      return a.value - b.value;
    });
    const vArr = [];
    const xNArr = [];
    temData.forEach((item, index) => {
      vArr[index] = item.value;
      xNArr[index] = item.name;
    });
    vArr.push({});
    // console.log('--------', vArr, xNArr)
    // 指定图表的配置项和数据
    const option = {
      // ----  标题 -----
      title: {
        text: this.indexLabelName,
        x: 'center',
        // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
        y: 'top',
        textStyle: {
          color: this.indexLabelColor,
        },
        subtext: '  ',
        subtextStyle: {
          color: 'blue',
        },
        padding: [20, 20, 10, 100], // 位置
      },

      grid: {
        x: 100,
        y: 100,
        x2: 100,
        y2: 100,
      },
      // ---- legend ----
      legend: {
        type: 'plain', // 图列类型，默认为 'plain'
        top: '1%', // 图列相对容器的位置 top\bottom\left\right
        selected: {
          // '销量': true  // 图列选择，图形加载出来会显示选择的图列，默认为true
        },
        textStyle: {
          // 图列内容样式
          color: '#fff', // 字体颜色
          backgroundColor: 'black', // 字体背景色
        },
        tooltip: {
          // 图列提示框，默认不显示
          show: true,
          color: 'red',
        },
        data: [
          // 图列内容
          {
            name: '销量',
            icon: 'circle',
            textStyle: {
              color: 'red', // 单独设置某一个图列的颜色
              backgroundColor: '#fff', // 单独设置某一个图列的字体背景色
            },
          },
        ],
      },
      // ---  提示框 ----
      tooltip: {
        show: true, // 是否显示提示框，默认为true
        trigger: 'item', // 数据项图形触发
        axisPointer: {
          // 指示样式
          type: 'shadow',
          axis: 'auto',
        },
        padding: 5,
        textStyle: {
          // 提示框内容的样式
          color: '#fff',
        },
      },
      // ---- gird区域 ---
      gird: {
        show: true, // 是否显示直角坐标系网格
        top: 80, // 相对位置 top\bottom\left\right
        containLabel: false, // gird 区域是否包含坐标轴的刻度标签
        tooltip: {
          show: true,
          trigger: 'item', // 触发类型
          textStyle: {
            color: '#666',
          },
        },
      },
      //  ------  X轴 ------
      //  xAxis: {
      yAxis: {
        show: true, // 是否显示
        position: 'bottom', // x轴的位置
        offset: 0, // x轴相对于默认位置的偏移
        type: 'category', // 轴类型， 默认为 'category'
        name: '', // 轴名称
        nameLocation: 'end', // 轴名称相对位置
        nameTextStyle: {
          // 坐标轴名称样式
          color: '#000',
          padding: [5, 0, 0, -5],
        },
        nameGap: 15, // 坐标轴名称与轴线之间的距离
        nameRotate: 0, // 坐标轴名字旋转
        axisLine: {
          // 坐标轴 轴线
          show: true, // 是否显示
          symbol: ['arrow', 'none'], // 是否显示轴线箭头
          symbolSize: [8, 8], // 箭头大小
          symbolOffset: [0, 7], // 箭头位置
          // ------   线 ---------
          lineStyle: {
            color: 'blue',
            width: 1,
            type: 'solid',
          },
        },
        axisTick: {
          // 坐标轴 刻度
          show: true, // 是否显示
          inside: true, // 是否朝内
          length: 3, // 长度
          lineStyle: {
            // 默认取轴线的样式
            color: 'red',
            width: 1,
            type: 'solid',
          },
        },
        axisLabel: {
          // 坐标轴标签
          show: true, // 是否显示
          inside: false, // 是否朝内
          margin: 10, // 刻度标签与轴线之间的距离
          color: '#555', // 默认取轴线的颜色
          interval: 0,
          rotate: 0,
        },
        splitLine: {
          // gird区域中的分割线
          show: false, // 是否显示
          lineStyle: {
            // color: 'red',
            // width: 1,
            // type: 'solid'
          },
        },
        splitArea: {
          // 网格区域
          show: false, // 是否显示，默认为false
        },
        data: xNArr,
      },
      //   ------   y轴  ----------
      //  yAxis: {
      xAxis: {
        type: 'value',
        name: '任务数(个)',
        position: 'top',
        minInterval: 1,
        min: 0,
        scale: true,
        nameLocation: 'end', // 轴名称相对位置value
        nameTextStyle: {
          // 坐标轴名称样式
          color: '#333',
          padding: [8, 0, 0, 8], // 坐标轴名称相对位置
        },
        nameGap: 8, // 坐标轴名称与轴线之间的距离
        // nameRotate: 270, // 坐标轴名字旋转
        axisLine: {
          // 坐标轴 轴线
          show: true, // 是否显示
          //  -----   箭头 -----
          symbol: ['none', 'arrow'], // 是否显示轴线箭头
          symbolSize: [8, 8], // 箭头大小
          symbolOffset: [0, 7], // 箭头位置

          // ----- 线 -------
          lineStyle: {
            color: 'blue',
            width: 1,
            type: 'solid',
          },
        },
        axisTick: {
          // 坐标轴的刻度
          show: true, // 是否显示
          inside: true, // 是否朝内
          length: 3, // 长度
          lineStyle: {
            color: 'red', // 默认取轴线的颜色
            width: 1,
            type: 'solid',
          },
        },
        axisLabel: {
          // 坐标轴的标签
          show: true, // 是否显示
          inside: false, // 是否朝内
          rotate: 0, // 旋转角度
          margin: 8, // 刻度标签与轴线之间的距离
          color: 'red', // 默认轴线的颜色
        },
        splitLine: {
          // gird 区域中的分割线
          show: false, // 是否显示
          lineStyle: {
            color: '#666',
            width: 1,
            type: 'dashed',
          },
        },
        splitArea: {
          // 网格区域
          show: false, // 是否显示，默认为false
        },
      },
      //  -------   内容数据 -------
      series: [
        {
          name: '卡片数', // 序列名称
          type: 'bar', // 类型
          legendHoverLink: true, // 是否启用图列 hover 时的联动高亮
          label: {
            // 图形上的文本标签
            show: true,
            // rotate: 0, // 旋转角度
            color: 'red',
            formatter: '{c}%',
            position: 'right', // 相对位置
          },
          itemStyle: {
            // 图形的形状
            normal: {
              //   color: new echarts.graphic.LinearGradient(
              //     0, 0, 0, 1, // 相当于2点的位置 A(0, 0)  B(1, 0)
              //     [
              //         {offset: 0, color: '#2980b9'}, // 柱图渐变色
              //         {offset: 1, color: '#D26D2B'}, // 柱图渐变色
              //     ]
              // ),
              label: {
                show: true, //开启显示
                position: 'right', //在上方显示
                textStyle: {
                  //数值样式
                  color: '#333',
                  fontSize: 16,
                },
              },
            },
            color: '#2980b9',
            // barBorderRadius: [18, 18, 0, 0]
          },
          barMinwidth: 40, // 柱形的宽度
          barCategoryGap: '50%', // 柱形的间距
          data: vArr,
        },
      ],
    };

    document.getElementById('labelsBar').style.height = `${vArr.length * 60 +
      200}px`;

    // 使用刚指定的配置项和数据显示图表。
    this.barChart = labelBarChart;
    document.getElementById(
      'labelsBar',
    ).children[0].style.height = `${vArr.length * 60 + 80}px`;
    document.getElementById('labelsBar').children[0].style.boxSizing =
      'border-box';
    document.getElementById('labelsBar').children[0].style.width = '100%';

    document.getElementById('labelsBar').children[0].style.flex = 1;

    setTimeout(() => {
      document.getElementById('labelsBar').style.minHeight = `${vArr.length *
        60 +
        200}px`;

      document.getElementById('labelsBar').style.opacity = 1;
      labelBarChart.setOption(option);
      setTimeout(() => {
        labelBarChart.resize();
      }, 100);
    }, 200);
    window.onresize = function() {
      labelBarChart.resize();
    };
  },
  initPieChart() {
    const labelsPie = document.getElementById('labelsPie');
    const labelPieChart = echarts.init(labelsPie, 'macarons');
    labelPieChart.off('click');
    const option = {
      title: {
        text: '标签统计图',
        subtext: this.seriesData.length > 0 ? '' : '暂无数据',
        // x 设置水平安放位置，默认左对齐，可选值：'center' ¦ 'left' ¦ 'right' ¦ {number}（x坐标，单位px）
        x: 'center',
        // y 设置垂直安放位置，默认全图顶端，可选值：'top' ¦ 'bottom' ¦ 'center' ¦ {number}（y坐标，单位px）
        y: 'top',
        // itemGap设置主副标题纵向间隔，单位px，默认为10，
        itemGap: this.seriesData.length > 0 ? 20 : 200,
        top: 30,
        // backgroundColor: '#EEE',
        // 主标题文本样式设置
        textStyle: {
          fontSize: 22,
          linHeight: 50,
          fontWeight: 'bolder',
          color: '#000080',
        },
        // 副标题文本样式设置
        subtextStyle: {
          fontSize: 14,
          color: '#8B2323',
        },
      },
      tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)',
      },

      legend: {
        data: [],
      },
      toolbox: {
        show: true,
        feature: {
          saveAsImage: {
            show: true,
            title: 'Descargar',
          },
        },
      },
      calculable: true,
      series: [
        {
          name: '当前看板',
          type: 'pie',
          zoom: 1.2,
          hoverAnimation: true,
          // radius: '50%',  // 设置饼状图大小，100%时，最大直径=整个图形的min(宽，高)
          // radius: ['30%', '60%'],  // 设置环形饼状图， 第一个百分数设置内圈大小，第二个百分数设置外圈大小
          radius: '50%', // 设置环形饼状图， 第一个百分数设置内圈大小，第二个百分数设置外圈大小
          center: ['50%', '50%'], // 设置饼状图位置，第一个百分数调水平位置，第二个百分数调垂直位置
          labelLine: {
            normal: {
              length: this.isMobileDevice() ? 10 : 25,
            },
          },
          // data: [{
          //     value: 335,
          //     name: '标签1'
          //   },
          //   {
          //     value: 310,
          //     name: '标签2'
          //   },
          //   {
          //     value: 234,
          //     name: '标签3'
          //   },
          //   {
          //     value: 135,
          //     name: '标签4'
          //   },
          //   {
          //     value: 148,
          //     name: '标签5'
          //   }
          // ],
          data: this.seriesData,
          // itemStyle 设置饼状图扇形区域样式
          itemStyle: {
            // emphasis：英文意思是 强调;着重;（轮廓、图形等的）鲜明;突出，重读
            // emphasis：设置鼠标放到哪一块扇形上面的时候，扇形样式、阴影
            emphasis: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(30, 144, 255，0.5)',
            },
          },
          label: {
            //展示文本设置
            normal: {
              emphasis: {
                shadowBlur: 10,
                shadowOffsetX: 3,
                shadowColor: 'rgba(32, 33, 36, .28)',
              },
              show: true, //展示
              fontSize: 10,
              color: '#848484',
              position: 'outside', // outside表示文本显示位置为外部
              // formatter:this.isMobileDevice()?"{main|{b}}": "{main|{b}}\n\n{c}个卡片\n({d}%)",
              formatter: '{main|{b}}',
              rich: {
                main: {
                  color: '#000',
                  fontSize: 14,
                  lineHeight: 20,
                  fontWeight: 'bold',
                  align: 'center',
                },
                sub: {
                  fontSize: 12,
                  color: '#848484',
                  lineHeight: 18,
                },
              },
            },
            emphasis: {
              //文本样式
              show: true, //展示
              textStyle: {
                //文本样式
                fontSize: '14',
                fontWeight: '600',
              },
            },
          },
        },
      ],
    };
    document.getElementById('labelsPie').children[0].style.boxSizing =
      'border-box';
    document.getElementById('labelsPie').children[0].style.width = '100%';
    document.getElementById('labelsPie').children[0].style.flex = 1;

    labelPieChart.on('rendered', () => {
      // console.log('-----rendered---', '');
    });
    labelPieChart.setOption(option);
    this.pieChart = labelPieChart;
    setTimeout(() => {
      if (!this.pieLoaded) {
        labelPieChart.resize();
        document.getElementById('labelsPie').style.opacity = 1;
        this.pieLoaded = true;
      }
    }, 0);
    labelPieChart.on('finished', () => {
      // console.log('-----finished---', this.pieLoaded);
    });
    labelPieChart.on('click', params => {
      // console.log('-----------labelPieChart.on(click--------', params);
      this.seriesUserData = [];
      this.indexLabelName = params.data.name;
      this.indexLabelColor = params.color;
      // console.log('-------members-------', this.members, this
      // .members
      // .length, params);
      // console.log('-------cards-------', this.cardList);

      const indexLabelCards = [];
      let lableArrI = 0;
      for (let i = 0; i < this.lableArr.length; i++) {
        const indexLable = this.lableArr[i];
        if (indexLable.name === params.data.name) {
          lableArrI = i;
        }
      }
      for (let i = 0; i < this.cardList.length; i++) {
        const card = this.cardList[i];
        const labelArr = card.labelIds;
        // console.log('--------i------', this.lableArr, labelArr, this
        //   .lableArr[
        //     params
        //     .dataIndex]);

        // if (labelArr.indexOf(this.lableArr[lableArrI]
        //     ._id) !== -
        //   1) {
        //  if (labelArr.indexOf(this.lableArr[params.dataIndex]._id) !== -1) {
        if (labelArr.length === 0) {
          if (params.data.id === 'noLabelId') indexLabelCards.push(card);
        } else if (labelArr.indexOf(params.data.id) !== -1)
          indexLabelCards.push(card);
      }
      // console.log('-------indexLabelCards-------', indexLabelCards);
      //-----------------------------modified by lvbing----------------------------------------------
      //筛选列表
      const popMenuToggleArr = this.popMenuToggleArrV1.get();
      const popIds = [];
      for (let s = 0; s < popMenuToggleArr.length; s++) {
        if (popMenuToggleArr[s].checked) popIds.push(popMenuToggleArr[s].popId);
      }

      //筛选人员
      const popMenu1ToggleArr1 = this.popMenu1ToggleArrV1.get();
      const popMemIds = [];
      for (let s = 0; s < popMenu1ToggleArr1.length; s++) {
        if (popMenu1ToggleArr1[s].checked)
          popMemIds.push(popMenu1ToggleArr1[s].popId);
      }

      for (let j = 0; j < this.members.length; j++) {
        let cardCount = 0;
        const user = this.members[j];
        for (let i = 0; i < indexLabelCards.length; i++) {
          const card = indexLabelCards[i];
          //  const memberIds = card.members;
          const memberIds = card.assignees;
          if (
            _.contains(popIds, card.listId) &&
            _.contains(popMemIds, user._id)
          ) {
            // if (memberIds.indexOf(user._id) !== -1) {
            //   cardCount++;
            // }
            if (memberIds.length === 0) {
              if (user._id === 'noAssigneeId') cardCount++;
            } else if (memberIds.indexOf(user._id) !== -1) cardCount++;
          }
        }
        if (_.contains(popMemIds, user._id))
          this.seriesUserData.push({
            value: cardCount,
            name: user.username,
            // name: user.profile.fullname,
          });
      }
      // for (let j = 0; j < this.members.length; j++) {
      //   let cardCount = 0
      //   const user = this.members[j];
      //   for (let i = 0; i < indexLabelCards.length; i++) {
      //     const card = indexLabelCards[i];
      //     const memberIds = card.members;
      //     if (memberIds.indexOf(user._id) !== -1) {
      //       cardCount++;
      //     }
      //   }
      //   this.seriesUserData.push({
      //     value: cardCount,
      //   //  name: user.username,
      //     name: user.profile.fullname,
      //   })
      // }
      const tab1C = this.$('.s-tab1');
      if (tab1C) {
        // console.log('---------scrollTop--------');
        tab1C.animate({
          scrollTop: 500,
        });
      }
      this.initBarChart();
      // console.log('-------this.seriesUserData--------', this
      // .seriesUserData);
    });
    window.onresize = function() {
      labelPieChart.resize();
    };
  },
  //------------modified by lvbing---------------
  popMenuToggleArr() {
    const tab0 = !!document
      .querySelectorAll('.s-tab-index')[0]
      .classList.contains('active');
    const tab1 = !!document
      .querySelectorAll('.s-tab-index')[1]
      .classList.contains('active');
    const tab2 = !!document
      .querySelectorAll('.s-tab-index')[2]
      .classList.contains('active');
    //周报统计
    if (tab0) return this.popMenuToggleArrV2.get();
    //标签统计
    else if (tab1) return this.popMenuToggleArrV1.get();
    //人员统计
    else return this.popMenuToggleArrV.get();
  },
  //------------modified by lvbing---------------
  popMenu1ToggleArr() {
    const tab0 = !!document
      .querySelectorAll('.s-tab-index')[0]
      .classList.contains('active');
    const tab1 = !!document
      .querySelectorAll('.s-tab-index')[1]
      .classList.contains('active');
    const tab2 = !!document
      .querySelectorAll('.s-tab-index')[2]
      .classList.contains('active');
    //周报统计
    if (tab0) return this.popMenu1ToggleArrV2.get();
    //标签统计
    else if (tab1) return this.popMenu1ToggleArrV1.get();
    //人员统计
    else return this.popMenu1ToggleArrV.get();
    //  return this.popMenu1ToggleArrV.get();
  },
  //------------modified by lvbing---------------
  titleArr() {
    // if(!document.querySelectorAll(".s-tab-index")[0])
    //   return this.titleArrV.get();
    // const tab0 = document.querySelectorAll(".s-tab-index")[0].classList.contains("active")?true:false;
    // //人员统计
    // if(tab0)
    //   return this.titleArrV.get();
    // //标签统计
    // else
    //   return this.titleArrV1.get();
    return this.titleArrV.get();
  },
  weektitleArr() {
    let weekArr1 = ['被指派人', '成员', '标题', '标签', '创建时间', '耗时'];
    return weekArr1;
  },
  setSetColumnViewShow(flag) {
    this.showSetColumnView.set(flag);
  },
  setSetStaffViewShow(flag) {
    this.showSetStaffView.set(flag);
  },
  setColumnViewShow() {
    return this.showSetColumnView.get();
  },
  setStaffViewShow() {
    return this.showSetStaffView.get();
  },
  tabIndex0() {
    return this.indexTab.get() === 0;
  },
  tabIndex1() {
    return this.indexTab.get() === 1;
  },
  tabIndex2() {
    return this.indexTab.get() === 2;
  },
  todoNum() {
    let num = 0;
    const arr = this.indexBoardUserArr.get();
    for (let i = 0; i < arr.length; i++) {
      const item = arr[i];
      num += item.todo;
    }
    return num;
  },
  doingNum() {
    let num = 0;
    const arr = this.indexBoardUserArr.get();
    for (let i = 0; i < arr.length; i++) {
      const item = arr[i];
      num += item.doing;
    }
    return num;
  },
  doneNum() {
    let num = 0;
    const arr = this.indexBoardUserArr.get();
    for (let i = 0; i < arr.length; i++) {
      const item = arr[i];
      num += item.done;
    }
    return num;
  },
  allNum() {
    let num = 0;
    const arr = this.indexBoardUserArr.get();
    for (let i = 0; i < arr.length; i++) {
      const item = arr[i];
      num += item.all;
    }
    return num;
  },
  todoShow(indexT) {
    // console.log('------indexT------', '');
    const popMenuToggleArr = this.popMenuToggleArrV.get();
    const index = popMenuToggleArr.indexOf(indexT);
    return this.popMenuToggleArrV.get()[index].checked;
  },
  doingShow() {
    return this.popMenuToggleArrV.get()[1].checked;
  },
  doneShow() {
    return this.popMenuToggleArrV.get()[2].checked;
  },
  allShow() {
    return this.popMenuToggleArrV.get()[3].checked;
  },
  boardUsersInfo() {
    return this.indexBoardUserArr.get();
  },

  thToDoFlag0() {
    return this.thArrFlag.get()[0].flag === 0;
  },
  thToDoFlag1() {
    return this.thArrFlag.get()[0].flag === 1;
  },
  thToDoFlag2() {
    return this.thArrFlag.get()[0].flag === 2;
  },

  thDoingFlag0() {
    return this.thArrFlag.get()[1].flag === 0;
  },
  thDoingFlag1() {
    return this.thArrFlag.get()[1].flag === 1;
  },
  thDoingFlag2() {
    return this.thArrFlag.get()[1].flag === 2;
  },

  thDoneFlag0() {
    return this.thArrFlag.get()[2].flag === 0;
  },
  thDoneFlag1() {
    return this.thArrFlag.get()[2].flag === 1;
  },
  thDoneFlag2() {
    return this.thArrFlag.get()[2].flag === 2;
  },

  thAllFlag0() {
    return this.thArrFlag.get()[3].flag === 0;
  },
  thAllFlag1() {
    return this.thArrFlag.get()[3].flag === 1;
  },
  thAllFlag2() {
    return this.thArrFlag.get()[3].flag === 2;
  },
  sortByKeyAsc(indexITh) {
    //---------------------modified by lvbing--------------------------
    // var titleArr;
    // const tab0 = document.querySelectorAll(".s-tab-index")[0].classList.contains("active")?true:false;
    // //人员统计
    // if(tab0)
    //   titleArr = this.titleArrV.get();
    // //标签统计
    // else
    //   titleArr = this.titleArrV1.get();
    const titleArr = this.titleArrV.get();
    const titleN = titleArr[indexITh];
    // console.log('------titleN-------', titleN);

    const arr = this.indexBoardUserArr.get();
    // console.log('------sortByKeyAsc---sort pre----', arr);
    arr.sort(function(a, b) {
      return a[titleN] - b[titleN];
    });
    // console.log('------sortByKeyAsc---sort after----', arr);

    setTimeout(() => {
      this.indexBoardUserArr.set(arr);
    }, 100);
  },
  sortByKeyDesc(indexITh) {
    //---------------------modified by lvbing--------------------------
    // var titleArr;
    // const tab0 = document.querySelectorAll(".s-tab-index")[0].classList.contains("active")?true:false;
    // //人员统计
    // if(tab0)
    //   titleArr = this.titleArrV.get();
    // //标签统计
    // else
    //   titleArr = this.titleArrV1.get();
    const titleArr = this.titleArrV.get();
    const titleN = titleArr[indexITh];
    // const flagArr = this.thArrFlag.get();
    // console.log('------titleN-------', titleN);

    const arr = this.indexBoardUserArr.get();
    arr.sort(function(a, b) {
      return b[titleN] - a[titleN];
    });
    this.indexBoardUserArr.set(arr);
  },
  //---------------------------added by lvbing--------------------------------------
  //标签统计下设置统计列,设置统计人员点击事件
  listClick() {
    this.seriesData = [];
    //筛选列表
    const popMenuToggleArr = this.popMenuToggleArrV1.get();
    const popIds = [];
    for (let s = 0; s < popMenuToggleArr.length; s++) {
      if (popMenuToggleArr[s].checked) popIds.push(popMenuToggleArr[s].popId);
    }
    // console.log("----------popIds-------", popIds);

    //筛选人员
    const popMenu1ToggleArr1 = this.popMenu1ToggleArrV1.get();
    const popMemIds = [];
    for (let s = 0; s < popMenu1ToggleArr1.length; s++) {
      if (popMenu1ToggleArr1[s].checked)
        popMemIds.push(popMenu1ToggleArr1[s].popId);
    }
    // console.log("----------popMemIds-------", popMemIds);

    //无标签卡片数量
    let indexLabelCardCount1 = 0;
    for (let i = 0; i < this.lableArr.length; i++) {
      let indexLabelCardCount = 0;
      const label = this.lableArr[i];
      for (let j = 0; j < this.cardList.length; j++) {
        const card = this.cardList[j];
        const cardLabelIdArr = card.labelIds;
        // console.log("----------card.listId-------", card.listId);
        //当前卡片被指派人是否包含设置的统计人员
        let isMemberIncluded;
        for (let s = 0; s < popMemIds.length; s++) {
          //  if (_.contains(card.members, popMemIds[s])) {
          //当前标签无指派人或者包含设置的被指派人
          if (card.assignees.length === 0) {
            if (_.contains(popMemIds, 'noAssigneeId')) {
              isMemberIncluded = true;
              break;
            }
          } else if (_.contains(card.assignees, popMemIds[s])) {
            isMemberIncluded = true;
            break;
          }
          // if (card.assignees.length === 0 || _.contains(card.assignees, popMemIds[s])) {
          //   isMemberIncluded = true;
          //   break;
          // }
        }
        if (_.contains(popIds, card.listId) && isMemberIncluded) {
          // for (let k = 0; k < cardLabelIdArr.length; k++) {
          //   const indexLabel = cardLabelIdArr[k];
          //   if (indexLabel === label._id) {
          //     indexLabelCardCount++;
          //   }
          // }
          //判断当前卡片是否有标签，若有，继续；若无，则命名为“无标签”
          if (cardLabelIdArr.length !== 0) {
            for (let k = 0; k < cardLabelIdArr.length; k++) {
              const indexLabel = cardLabelIdArr[k];
              if (indexLabel === label._id) {
                indexLabelCardCount++;
              }
            }
          } else if (i === this.lableArr.length - 1) {
            //所有卡片只统计一次无标签情况
            indexLabelCardCount1++;
          }
        }
      }
      //   if (indexLabelCardCount !== 0)
      //     this.seriesData.push({
      //       value: indexLabelCardCount,
      //       name: label.name,
      //       itemStyle: {
      //         normal: {
      //           color: label.color
      //         }
      //       }
      //     });

      // }
      /**新增颜色码值转换 */
      const extentLabelColors = [];
      extentLabelColors.push({
        'c-darkred-0': '#9f1a1a',
        'c-darkred-1': '#d95050',
        'c-darkred-2': '#f28a8a',
        'c-darkred-3': '#fcbaba',
        'c-darkred-4': '#ffe2e2',

        'c-darkorange-0': '#be572c',
        'c-darkorange-1': '#e16f6f',
        'c-darkorange-2': '#f99a71',
        'c-darkorange-3': '#fdb384',
        'c-darkorange-4': '#ffe5d4',

        'c-darkgray-0': '#7a4e1e',
        'c-darkgray-1': '#bd8e5d',
        'c-darkgray-2': '#e0b07c',
        'c-darkgray-3': '#f6d2ac',
        'c-darkgray-4': '#f2e4d5',

        'c-darkpurple-0': '#4e2471',
        'c-darkpurple-1': '#8e4aa9',
        'c-darkpurple-2': '#c78cde',
        'c-darkpurple-3': '#e1b6ea',
        'c-darkpurple-4': '#f2d9f8',

        'c-darkblue-0': '#145a91',
        'c-darkblue-1': '#4f8dbb',
        'c-darkblue-2': '#73b9eb',
        'c-darkblue-3': '#abd8fa',
        'c-darkblue-4': '#e1f2ff',

        'c-darkseagreen-0': '#069091',
        'c-darkseagreen-1': '#22c6ca',
        'c-darkseagreen-2': '#7adadf',
        'c-darkseagreen-3': '#b1f0fa',
        'c-darkseagreen-4': '#d5f7fa',

        'c-darkgreen-0': '#2d6e43',
        'c-darkgreen-1': '#5ca685',
        'c-darkgreen-2': '#86ccad',
        'c-darkgreen-3': '#bae5d2',
        'c-darkgreen-4': '#e5faf1',
      });
      const params = label.color;
      let mylabelColor = '';
      const extentLabelColor = extentLabelColors[0];
      if (params.indexOf('c-') !== -1) {
        mylabelColor = extentLabelColor[params];
      } else {
        mylabelColor = label.color;
      }
      if (indexLabelCardCount !== 0) {
        this.seriesData.push({
          value: indexLabelCardCount,
          //  name: label.name,
          id: label._id,
          name: label.name === '' ? '未命名' : label.name,
          itemStyle: {
            normal: {
              // color: label.color,
              color: mylabelColor,
            },
          },
        });
      }
    }
    //所有标签统计完后，统计无标签卡片
    if (indexLabelCardCount1 !== 0) {
      this.seriesData.push({
        value: indexLabelCardCount1,
        id: 'noLabelId',
        name: '无标签',
        itemStyle: {
          normal: {
            color: '#000',
          },
        },
      });
    }
    //渲染饼图
    this.initPieChart();
  },

  events() {
    return [
      {
        'click .js-sorting': evt => {
          const target = evt.target;
          const thArrFlag = this.thArrFlag.get();
          //---------------------modified by lvbing--------------------------
          // var titleArr;
          // const tab0 = document.querySelectorAll(".s-tab-index")[0].classList.contains("active")?true:false;
          // //人员统计
          // if(tab0)
          //   titleArr = this.titleArrV.get();
          // //标签统计
          // else
          //   titleArr = this.titleArrV1.get();
          const titleArr = this.titleArrV.get();
          const TemA = [...titleArr];
          TemA.shift();
          // console.log('-----titleArr------', titleArr)
          let index = -1;
          const thT = target.innerText.substring(
            0,
            target.innerText.indexOf('('),
          );
          const indexITh = titleArr.indexOf(thT);
          index = TemA.indexOf(thT);

          const hTh = document.getElementById('s-tb-tr-h').children;

          // console.log('---titleArr---target.innerText--index-------',
          //   titleArr, target.innerText, index);

          for (let i = 0; i < hTh.length; i++) {
            const element = hTh[i];
            if (i !== 0) {
              element.children[0].classList.remove('fa-sort');
              element.children[0].classList.remove('fa-sort-amount-asc');
              element.children[0].classList.remove('fa-sort-amount-desc');
              element.children[0].classList.add('fa-sort');
              element.children[0].style.opacity = 0.2;
            }
          }
          // console.log('------index----', thArrFlag, index);
          if (thArrFlag[index].flag === 0) {
            this.sortByKeyAsc(index + 1);
            thArrFlag[index].flag = 1;

            hTh[index + 1].children[0].classList.add('fa-sort-amount-asc');
          } else if (thArrFlag[index].flag === 1) {
            this.sortByKeyDesc(index + 1);
            thArrFlag[index].flag = 2;
            hTh[index + 1].children[0].classList.add('fa-sort-amount-desc');
          } else if (thArrFlag[index].flag === 2) {
            this.sortByKeyAsc(index + 1);
            thArrFlag[index].flag = 1;
            hTh[index + 1].children[0].classList.add('fa-sort-amount-asc');
          }
          hTh[index + 1].children[0].style.opacity = 0.5;
          this.thArrFlag.set(thArrFlag);
        },
        'click .js-set-coclumn'(event) {
          event.stopPropagation();
          document.getElementsByClassName(
            'js-set-coclumn',
          )[0].style.backgroundColor = '#e6e6e6';
          this.setSetColumnViewShow(true);
        },
        'click .js-set-staff'(event) {
          event.stopPropagation();
          document.getElementsByClassName(
            'js-set-staff',
          )[0].style.backgroundColor = '#e6e6e6';
          this.setSetStaffViewShow(true);
        },
        'click .js-closeD-modal': () => {
          Modal.close();
          exanded = false;
          // if(!document.querySelector("#modal-header").offsetWidth+2==window.screen.width){
          //   exanded = !exanded;
          // }
        },
        // 'click .js-pop-item': (evt) => {
        //   const target = evt.target;
        //   const popMenuToggleArr = this.popMenuToggleArrV.get();
        //   const sTbSrD = document.getElementsByClassName("s-tb-tr");

        //   let clickIndex = -1;
        //   for (let i = 0; i < popMenuToggleArr.length; i++) {
        //     const element = popMenuToggleArr[i];
        //     if (element.popTitle === target.innerText) {
        //       clickIndex = i;
        //       break;
        //     }
        //   }
        //   popMenuToggleArr[clickIndex].checked = !popMenuToggleArr[
        //     clickIndex].checked;
        //   const hTr = document.getElementById("s-tb-tr-h");

        //   if (popMenuToggleArr[clickIndex].checked) {
        //     hTr.children[clickIndex + 1].style.display = "table-cell";
        //     for (let i = 0; i < sTbSrD.length; i++) {
        //       const sTbSrDIndex = sTbSrD[i];
        //       sTbSrDIndex.children[clickIndex + 1].style.display =
        //         "table-cell";
        //     }
        //   } else {
        //     hTr.children[clickIndex + 1].style.display = "none";
        //     for (let i = 0; i < sTbSrD.length; i++) {
        //       const sTbSrDIndex = sTbSrD[i];
        //       sTbSrDIndex.children[clickIndex + 1].style.display =
        //         "none";
        //     }
        //   }
        //   this.popMenuToggleArrV.set(popMenuToggleArr);

        // },
        //--------------modified by lvbing-----------------------
        'click .js-pop-item': evt => {
          //判断当前是人员统计还是标签统计页面
          //周报统计
          const tab0 = !!document
            .querySelectorAll('.s-tab-index')[0]
            .classList.contains('active');
          //标签统计
          const tab1 = !!document
            .querySelectorAll('.s-tab-index')[1]
            .classList.contains('active');
          //人员统计
          const tab2 = !!document
            .querySelectorAll('.s-tab-index')[2]
            .classList.contains('active');
          const target = evt.target;
          let popMenuToggleArr;
          //人员统计
          //if (!tab0) popMenuToggleArr = this.popMenuToggleArrV.get();
          //标签统计
          //else
          popMenuToggleArr = this.popMenuToggleArr();

          const sTbSrD = document.getElementsByClassName('s-tb-tr');

          let clickIndex = -1;
          for (let i = 0; i < popMenuToggleArr.length; i++) {
            const element = popMenuToggleArr[i];
            if (element.popTitle === target.innerText) {
              clickIndex = i;
              break;
            }
          }
          popMenuToggleArr[clickIndex].checked = !popMenuToggleArr[clickIndex]
            .checked;

          //人员统计
          if (tab2) {
            const hTr = document.getElementById('s-tb-tr-h');
            if (popMenuToggleArr[clickIndex].checked) {
              hTr.children[clickIndex + 1].style.display = 'table-cell';
              for (let i = 0; i < sTbSrD.length; i++) {
                const sTbSrDIndex = sTbSrD[i];
                sTbSrDIndex.children[clickIndex + 1].style.display =
                  'table-cell';
              }
            } else {
              hTr.children[clickIndex + 1].style.display = 'none';
              for (let i = 0; i < sTbSrD.length; i++) {
                const sTbSrDIndex = sTbSrD[i];
                sTbSrDIndex.children[clickIndex + 1].style.display = 'none';
              }
            }
          }
          //标签统计
          else if (tab1) {
            //-------------------------modified by lvbing------------------------------------
            const tab1C = this.$('.s-tab1');
            if (tab1C.scrollTop !== 0) {
              document.getElementById('labelsBar').style.opacity = 0;
              tab1C.animate({
                scrollTop: 0,
              });
            }
            this.listClick();
          } else {
            this.dataArray = this.weekUsersInfo();
            this.dataArr.set(this.dataArray);
            let pageTotal = this.totalPage.get();
            let _this = this;
            $('#pagination1').pagination({
              currentPage: 1,
              totalPage: pageTotal,
              callback: function(current) {
                _this.pageNo = parseInt(current);
                _this.dataArray = _this.weekUsersInfo();
                _this.dataArr.set(_this.dataArray);
                window.setImmediate(function() {
                  _this.getSvg();
                }, 0);
              },
            });
            window.setImmediate(function() {
              _this.getSvg();
            }, 0);
          }
          if (tab2) this.popMenuToggleArrV.set(popMenuToggleArr);
          //标签统计
          else if (tab1) this.popMenuToggleArrV1.set(popMenuToggleArr);
          /**********************************modified by lvbing*******2021-06-02***************************************/
          //周报统计
          else this.popMenuToggleArrV2.set(popMenuToggleArr);
          /**********************************modified by lvbing*******2021-06-02***************************************/
        },

        // 'click .js-pop-item1': (evt) => {
        //   const target = evt.target;
        //   const popMenuToggleArr = this.popMenu1ToggleArrV.get();
        //   // this.aa =  this.indexBoardUserArr.get();
        //   const indexBoardUserArr = this.indexBoardUserArr.get();
        //   console.log('----indexBoardUserArr-----',
        //     indexBoardUserArr);
        //   const TemArr = [];
        //   let clickIndex = -1;
        //   let clickIndexName = "";
        //   for (let i = 0; i < popMenuToggleArr.length; i++) {
        //     const element = popMenuToggleArr[i];
        //     if (element.popTitle === target.innerText) {
        //       clickIndex = i;
        //       break;
        //     }
        //   }
        //   popMenuToggleArr[clickIndex].checked = !popMenuToggleArr[
        //     clickIndex].checked;
        //   console.log('------00--clickIndex---', clickIndex);
        //   let indexD = -1;
        //   let indexA = -1;

        //   for (let i = 0; i < this.aa.length; i++) {
        //     const element = this.aa[i];
        //     console.log('------01-----', popMenuToggleArr[
        //         clickIndex]
        //       .popTitle, element.userName);

        //     if (popMenuToggleArr[clickIndex].popTitle === element
        //       .userName) {

        //       if (popMenuToggleArr[clickIndex].checked) {
        //         indexA = i;
        //         console.log(
        //           '-------popMenuToggleArr[clickIndex].checked-----',
        //           indexA);
        //         break;
        //       } else {
        //         indexD = i;
        //         console.log(
        //           '-------popMenuToggleArr[clickIndex].checked---FALSE--',
        //           indexD);
        //         break;
        //       }
        //     }
        //   }
        //   if (indexA !== -1) {
        //     indexBoardUserArr.splice(0, 0, this.aa[indexA]);
        //   } else {
        //     for (let i = 0; i < indexBoardUserArr.length; i++) {
        //       const element = indexBoardUserArr[i];
        //       if (popMenuToggleArr[clickIndex].popTitle === element
        //         .userName) {
        //         indexD = i;
        //         break;
        //       }
        //     }
        //     indexBoardUserArr.splice(indexD, 1);
        //   }
        //   this.indexBoardUserArr.set(indexBoardUserArr);
        //   this.popMenu1ToggleArrV.set(popMenuToggleArr);
        // },
        //--------------------------------modified by lvbing-------------------------------
        'click .js-pop-item1': evt => {
          //判断当前是人员统计还是标签统计页面
          //周报统计
          const tab0 = !!document
            .querySelectorAll('.s-tab-index')[0]
            .classList.contains('active');
          //标签统计
          const tab1 = !!document
            .querySelectorAll('.s-tab-index')[1]
            .classList.contains('active');
          //人员统计
          const tab2 = !!document
            .querySelectorAll('.s-tab-index')[2]
            .classList.contains('active');
          let popMenuToggleArr;
          //人员统计
          //if (!tab0) popMenuToggleArr = this.popMenu1ToggleArrV.get();
          //标签统计
          // else popMenuToggleArr = this.popMenu1ToggleArrV1.get();
          popMenuToggleArr = this.popMenu1ToggleArr();
          const target = evt.target;
          // this.aa =  this.indexBoardUserArr.get();
          const indexBoardUserArr = this.indexBoardUserArr.get();
          // console.log('----indexBoardUserArr-----',
          //   indexBoardUserArr);
          let clickIndex = -1;
          for (let i = 0; i < popMenuToggleArr.length; i++) {
            const element = popMenuToggleArr[i];
            if (element.popTitle === target.innerText) {
              clickIndex = i;
              break;
            }
          }
          popMenuToggleArr[clickIndex].checked = !popMenuToggleArr[clickIndex]
            .checked;
          // console.log('------00--clickIndex---', clickIndex);

          //人员统计
          if (tab2) {
            let indexD = -1;
            let indexA = -1;

            for (let i = 0; i < this.aa.length; i++) {
              const element = this.aa[i];
              // console.log('------01-----', popMenuToggleArr[
              //     clickIndex]
              //   .popTitle, element.userName);

              if (popMenuToggleArr[clickIndex].popTitle === element.userName) {
                if (popMenuToggleArr[clickIndex].checked) {
                  indexA = i;
                  // console.log(
                  //   '-------popMenuToggleArr[clickIndex].checked-----',
                  //   indexA);
                  break;
                } else {
                  indexD = i;
                  // console.log(
                  //   '-------popMenuToggleArr[clickIndex].checked---FALSE--',
                  //   indexD);
                  break;
                }
              }
            }
            if (indexA !== -1) {
              indexBoardUserArr.splice(0, 0, this.aa[indexA]);
            } else {
              for (let i = 0; i < indexBoardUserArr.length; i++) {
                const element = indexBoardUserArr[i];
                if (
                  popMenuToggleArr[clickIndex].popTitle === element.userName
                ) {
                  indexD = i;
                  break;
                }
              }
              indexBoardUserArr.splice(indexD, 1);
            }
          }

          //标签统计
          else if (tab1) {
            //-------------------------modified by lvbing-----------------------------------
            const tab1C = this.$('.s-tab1');
            if (tab1C.scrollTop !== 0) {
              document.getElementById('labelsBar').style.opacity = 0;
              tab1C.animate({
                scrollTop: 0,
              });
            }
            this.listClick();
          } else {
            // const curDate = new Date();
            // const preDate = new Date(curDate.getTime() - 24 * 60 * 60 * 1000); //前一天
            // const nextDate = new Date(curDate.getTime() + 24 * 60 * 60 * 1000); //后一天
            // const query = {
            //   fromDate: this.startTime,
            //   toDate: this.end,
            //   pageNo: 1,
            // };
            this.dataArray = this.weekUsersInfo();
            this.dataArr.set(this.dataArray);
            let pageTotal = this.totalPage.get();
            let _this = this;
            $('#pagination1').pagination({
              currentPage: 1,
              totalPage: pageTotal,
              callback: function(current) {
                _this.pageNo = parseInt(current);
                _this.dataArray = _this.weekUsersInfo();
                _this.dataArr.set(_this.dataArray);
                window.setImmediate(function() {
                  _this.getSvg();
                }, 0);
              },
            });
            window.setImmediate(function() {
              _this.getSvg();
            }, 0);
          }
          /**********************************modified by lvbing*******2021-06-02***************************************/

          //人员统计
          if (tab2) {
            this.indexBoardUserArr.set(indexBoardUserArr);
            this.popMenu1ToggleArrV.set(popMenuToggleArr);
          }
          //标签统计
          else if (tab1) this.popMenu1ToggleArrV1.set(popMenuToggleArr);
          /**********************************modified by lvbing*******2021-06-02***************************************/
          //周报统计
          else this.popMenu1ToggleArrV2.set(popMenuToggleArr);
          /**********************************modified by lvbing*******2021-06-02***************************************/
        },
        'click .js-expandD': (event, instance) => {
          // console.log('tag', '')
          // this.pieChart&&this.pieChart.resize();
          // const instance = Template.instance();
          if (exanded) {
            document.getElementsByClassName(
              'modal-content',
            )[0].style.margin = 0;
            document.getElementsByClassName(
              'modal-header',
            )[0].style.borderRadius = '0px';
            // document.getElementsByClassName("modal-content")[0].style.borderradius="0px";
            document.getElementsByClassName('modal-container')[0].style.width =
              '100%';
            document.getElementsByClassName('modal-container')[0].style.height =
              '100%';
            document.getElementsByClassName(
              'modal-content',
            )[0].style.margin = 0;
            document
              .getElementsByClassName('expandS')[0]
              .classList.remove('fa-expand');
            document
              .getElementsByClassName('expandS')[0]
              .classList.add('fa-compress');
            document.getElementsByClassName('modal-content')[0].style.inset = 0;
            $('#modal-content').draggable('disable');
            document.getElementsByClassName('expandS')[0].style.opacity = 1;
            // document.getElementsByClassName(
            //   'modal-container',
            // )[0].style.transition = 'all 0.5s';
          } else {
            document.getElementsByClassName('modal-content')[0].style.margin =
              '20px auto';
            document.getElementsByClassName(
              'modal-header',
            )[0].style.borderRadius = '6px';
            // document.getElementsByClassName("modal-content")[0].style.borderRaduis="6px";
            document.getElementsByClassName('modal-container')[0].style.width =
              '900px';
            document.getElementsByClassName('modal-container')[0].style.height =
              'auto';
            document
              .getElementsByClassName('expandS')[0]
              .classList.remove('fa-compress');
            document
              .getElementsByClassName('expandS')[0]
              .classList.add('fa-expand');
            $('#modal-content').draggable('enable');
            // document.getElementsByClassName(
            //   'modal-container',
            // )[0].style.transition = 'all 0.5s';
          }
          exanded = !exanded;
          // exandedFlag = 0;
          this.pieChart && this.pieChart.resize();
          this.barChart && this.barChart.resize();
        },
        'click .button_left': () => {
          let prevWeekone =
            new Date(
              document.querySelector('.start_time').innerText,
            ).getTime() -
            7 * 24 * 60 * 60 * 1000;
          let startArray = new Date(prevWeekone)
            .toLocaleDateString()
            .split('/');
          if (parseInt(startArray[1]) < 10) {
            startArray[1] = 0 + startArray[1];
          }
          if (parseInt(startArray[2]) < 10) {
            startArray[2] = 0 + startArray[2];
          }
          let prevWeekTime = startArray.join('-');
          document.querySelector('.start_time').innerText = prevWeekTime;

          let prevWeek =
            new Date(document.querySelector('.end_time').innerText).getTime() -
            7 * 24 * 60 * 60 * 1000;
          let endArray = new Date(prevWeek).toLocaleDateString().split('/');
          if (parseInt(endArray[1]) < 10) {
            endArray[1] = 0 + endArray[1];
          }
          if (parseInt(endArray[2]) < 10) {
            endArray[2] = 0 + endArray[2];
          }
          let prevWeekTime1 = endArray.join('-');
          document.querySelector('.end_time').innerText = prevWeekTime1;
          this.startTime = new Date(
            document
              .querySelector('.start_time')
              .innerText.split('-')
              .join('/'),
          );
          this.endTime = new Date(
            document
              .querySelector('.end_time')
              .innerText.split('-')
              .join('/'),
          );
          this.pageNo = 1;
          this.dataArray = this.weekUsersInfo();
          this.dataArr.set(this.dataArray);
          let pageTotal = this.totalPage.get();
          let _this = this;
          $('#pagination1').pagination({
            currentPage: 1,
            totalPage: pageTotal,
            callback: function(current) {
              _this.pageNo = parseInt(current);
              _this.dataArray = _this.weekUsersInfo();
              _this.dataArr.set(_this.dataArray);
              window.setImmediate(function() {
                _this.getSvg();
              }, 0);
            },
          });
          window.setImmediate(function() {
            _this.getSvg();
          }, 0);
        },
        'click .button_right': () => {
          let prevWeekone =
            new Date(
              document.querySelector('.start_time').innerText,
            ).getTime() +
            7 * 24 * 60 * 60 * 1000;
          let startArray = new Date(prevWeekone)
            .toLocaleDateString()
            .split('/');
          if (parseInt(startArray[1]) < 10) {
            startArray[1] = 0 + startArray[1];
          }
          if (parseInt(startArray[2]) < 10) {
            startArray[2] = 0 + startArray[2];
          }
          let prevWeekTime = startArray.join('-');
          document.querySelector('.start_time').innerText = prevWeekTime;

          let prevWeek =
            new Date(document.querySelector('.end_time').innerText).getTime() +
            7 * 24 * 60 * 60 * 1000;
          let endArray = new Date(prevWeek).toLocaleDateString().split('/');
          if (parseInt(endArray[1]) < 10) {
            endArray[1] = 0 + endArray[1];
          }
          if (parseInt(endArray[2]) < 10) {
            endArray[2] = 0 + endArray[2];
          }
          let prevWeekTime1 = endArray.join('-');
          document.querySelector('.end_time').innerText = prevWeekTime1;
          this.startTime = new Date(
            document
              .querySelector('.start_time')
              .innerText.split('-')
              .join('/'),
          );
          this.endTime = new Date(
            document
              .querySelector('.end_time')
              .innerText.split('-')
              .join('/'),
          );
          this.pageNo = 1;
          this.dataArray = this.weekUsersInfo();
          this.dataArr.set(this.dataArray);
          let pageTotal = this.totalPage.get();
          let _this = this;
          $('#pagination1').pagination({
            currentPage: 1,
            totalPage: pageTotal,
            callback: function(current) {
              _this.pageNo = parseInt(current);
              _this.dataArray = _this.weekUsersInfo();
              _this.dataArr.set(_this.dataArray);
              window.setImmediate(function() {
                _this.getSvg();
              }, 0);
            },
          });
          window.setImmediate(function() {
            _this.getSvg();
          }, 0);
        },
        'click .js_week': () => {
          const curDate = new Date();
          let startTime = new Date(
            curDate.getTime() - (curDate.getDay() - 1) * 24 * 60 * 60 * 1000,
          ).toLocaleDateString();
          let startArray = startTime.split('/');
          if (parseInt(startArray[1]) < 10) {
            startArray[1] = 0 + startArray[1];
          }
          if (parseInt(startArray[2]) < 10) {
            startArray[2] = 0 + startArray[2];
          }
          let weekOne = startArray.join('-');
          document.querySelector('.start_time').innerText = weekOne;
          let endTime = new Date(
            curDate.getTime() + (7 - curDate.getDay()) * 24 * 60 * 60 * 1000,
          ).toLocaleDateString();
          let endArray = endTime.split('/');
          if (parseInt(endArray[1]) < 10) {
            endArray[1] = 0 + endArray[1];
          }
          if (parseInt(endArray[2]) < 10) {
            endArray[2] = 0 + endArray[2];
          }
          let week = endArray.join('-');
          document.querySelector('.end_time').innerText = week;
          this.startTime = new Date(
            document
              .querySelector('.start_time')
              .innerText.split('-')
              .join('/'),
          );
          this.endTime = new Date(
            document
              .querySelector('.end_time')
              .innerText.split('-')
              .join('/'),
          );
          this.pageNo = 1;
          this.dataArray = this.weekUsersInfo();
          this.dataArr.set(this.dataArray);
          let pageTotal = this.totalPage.get();
          let _this = this;
          $('#pagination1').pagination({
            currentPage: 1,
            totalPage: pageTotal,
            callback: function(current) {
              _this.pageNo = parseInt(current);
              _this.dataArray = _this.weekUsersInfo();
              _this.dataArr.set(_this.dataArray);
              window.setImmediate(function() {
                _this.getSvg();
              }, 0);
            },
          });
          window.setImmediate(function() {
            _this.getSvg();
          }, 0);
        },
        'click .js-search': event => {
          event.preventDefault();
          event.stopPropagation();
          if (
            document.querySelector('.start_time').innerText >
            document.querySelector('.end_time').innerText
          ) {
            alert('开始时间应小于结束时间');
            return;
          }
          this.startTime = new Date(
            document
              .querySelector('.start_time')
              .innerText.split('-')
              .join('/'),
          );
          this.endTime = new Date(
            document
              .querySelector('.end_time')
              .innerText.split('-')
              .join('/'),
          );
          this.pageNo = 1;
          this.dataArray = this.weekUsersInfo();
          this.dataArr.set(this.dataArray);
          let pageTotal = this.totalPage.get();
          let _this = this;
          $('#pagination1').pagination({
            currentPage: 1,
            totalPage: pageTotal,
            callback: function(current) {
              _this.pageNo = parseInt(current);
              _this.dataArray = _this.weekUsersInfo();
              _this.dataArr.set(_this.dataArray);
              window.setImmediate(function() {
                _this.getSvg();
              }, 0);
            },
          });
          window.setImmediate(function() {
            _this.getSvg();
          }, 0);
          //console.log(this.dataArr);
        },
        'blur .js_page': evt => {
          evt.stopPropagation();
          evt.preventDefault();
          let num = document.querySelector('.js_page').value;
          this.pageSize = parseInt(num);
          this.pageNo = 1;
          this.dataArray = this.weekUsersInfo();
          this.dataArr.set(this.dataArray);
          let pageTotal = this.totalPage.get();
          //console.log(pageTotal);
          let _this = this;
          $('#pagination1').pagination({
            currentPage: 1,
            totalPage: pageTotal,
            callback: function(current) {
              _this.pageNo = parseInt(current);
              _this.dataArray = _this.weekUsersInfo();
              _this.dataArr.set(_this.dataArray);
              window.setImmediate(function() {
                _this.getSvg();
              }, 0);
            },
          });
          window.setImmediate(function() {
            _this.getSvg();
          }, 0);
        },
        'click .js-s-tab1': () => {
          this.indexTab.set(0);
          document.querySelectorAll('.s-tab-index')[0].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[0].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[0].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[1].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[1].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[1].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[2].style.border =
            '1px solid #ddd';
          document.querySelectorAll('.s-tab-index')[2].style.borderBottomColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[2].style.backgroundColor =
            'white';
          document.querySelectorAll('.s-tab-index')[2].style.color = '#555555';
          document
            .querySelectorAll('.s-tab-index')[0]
            .classList.remove('active');
          document
            .querySelectorAll('.s-tab-index')[1]
            .classList.remove('active');
          document.querySelectorAll('.s-tab-index')[2].classList.add('active');
        },
        'click .js-s-tab3': () => {
          this.indexTab.set(2);
          document.querySelectorAll('.s-tab-index')[2].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[2].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[2].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[1].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[1].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[1].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[0].style.border =
            '1px solid #ddd';
          document.querySelectorAll('.s-tab-index')[0].style.borderBottomColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[0].style.backgroundColor =
            'white';
          document.querySelectorAll('.s-tab-index')[0].style.color = '#555555';
          document
            .querySelectorAll('.s-tab-index')[2]
            .classList.remove('active');
          document
            .querySelectorAll('.s-tab-index')[1]
            .classList.remove('active');
          document.querySelectorAll('.s-tab-index')[0].classList.add('active');
        },
        //饼图
        'click .js-s-tab2': () => {
          this.indexTab.set(1);
          if (!this.pieLoaded) {
            this.initPieChart();
          } else {
            setTimeout(() => {
              this.pieChart && this.pieChart.resize();
              this.barChart && this.barChart.resize();
            }, 0);
          }
          document.querySelectorAll('.s-tab-index')[0].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[0].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[0].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[2].style.backgroundColor =
            'transparent';
          document.querySelectorAll('.s-tab-index')[2].style.color = '#428bca';
          document.querySelectorAll('.s-tab-index')[2].style.border =
            '1px solid transparent';
          document.querySelectorAll('.s-tab-index')[1].style.backgroundColor =
            'white';
          document.querySelectorAll('.s-tab-index')[1].style.color = '#555555';
          document.querySelectorAll('.s-tab-index')[1].style.border =
            '1px solid #ddd';
          document.querySelectorAll('.s-tab-index')[1].style.borderBottomColor =
            'transparent';
          document
            .querySelectorAll('.s-tab-index')[0]
            .classList.remove('active');
          document
            .querySelectorAll('.s-tab-index')[2]
            .classList.remove('active');
          document.querySelectorAll('.s-tab-index')[1].classList.add('active');
        },
      },
    ];
  },
}).register('statisticsIndexBoard');

BlazeComponent.extendComponent({
  time() {
    const curDate = new Date();
    let timeArray = [];
    let obj = {};
    let startTime = new Date(
      curDate.getTime() - (curDate.getDay() - 1) * 24 * 60 * 60 * 1000,
    ).toLocaleDateString();
    let startArray = startTime.split('/');
    if (parseInt(startArray[1]) < 10) {
      startArray[1] = 0 + startArray[1];
    }
    if (parseInt(startArray[2]) < 10) {
      startArray[2] = 0 + startArray[2];
    }
    obj.startTime = startArray.join('-');
    let endTime = new Date(
      curDate.getTime() + (7 - curDate.getDay()) * 24 * 60 * 60 * 1000,
    ).toLocaleDateString();
    let endArray = endTime.split('/');
    if (parseInt(endArray[1]) < 10) {
      endArray[1] = 0 + endArray[1];
    }
    if (parseInt(endArray[2]) < 10) {
      endArray[2] = 0 + endArray[2];
    }
    obj.endTime = endArray.join('-');
    timeArray.push(obj);
    return timeArray;
  },
}).register('weekTimePopup');
// (class extends DatePicker {
//   time() {
//     const curDate = new Date();
//     let timeArray = [];
//     let obj = {};
//     let startTime = new Date(
//       curDate.getTime() - (curDate.getDay() - 1) * 24 * 60 * 60 * 1000,
//     ).toLocaleDateString();
//     let startArray = startTime.split('/');
//     if (parseInt(startArray[1]) < 10) {
//       startArray[1] = 0 + startArray[1];
//     }
//     if (parseInt(startArray[2]) < 10) {
//       startArray[2] = 0 + startArray[2];
//     }
//     obj.startTime = startArray.join('-');
//     let endTime = new Date(
//       curDate.getTime() + (7 - curDate.getDay()) * 24 * 60 * 60 * 1000,
//     ).toLocaleDateString();
//     let endArray = endTime.split('/');
//     if (parseInt(endArray[1]) < 10) {
//       endArray[1] = 0 + endArray[1];
//     }
//     if (parseInt(endArray[2]) < 10) {
//       endArray[2] = 0 + endArray[2];
//     }
//     obj.endTime = endArray.join('-');
//     timeArray.push(obj);
//     return timeArray;
//   }
//   events() {
//     return [
//       {
//         'click .start_time': ()=>{
//           Popup.open("weekTime");
//         }
//       },]
//   }
//   onCreated() {
//     //const aaa = this.data();
//     super.onCreated(moment().format('YYYY-MM-DD HH:mm'));
//     //this.data().getStart() && this.date.set(moment(this.data().getStart()));
//   }
//   onRendered() {
//     super.onRendered();
//     if (moment.isDate(this.card.getReceived())) {
//       this.$('.js-datepicker').datepicker(
//         'setStartDate',
//         this.card.getReceived(),
//       );
//     }
//     // if (!this.data().getStart()) {
//     //   $('#date').val(moment().format('YYYY-MM-DD'));
//     //   $('#timeHH').val(moment().format('HH'));
//     //   $('#timeMM').val(moment().format('MM'));
//     // }
//   }
//   _storeDate(date) {
//    // this.card.setStart(date);
//   }

//   _deleteDate() {
//    // this.card.setStart(null);
//   }
// }.register('weekTimePopup'));
